msvgc
Initial release
用於從普通SVG文件生成React組件的UTITS
(與反應兼容)
# install package globally
npm install -g msvgc # provide for utils
msvgc -f ./path/to/pic.svg -o ./svgComponents/ --camelCase標誌創建使用駱駝盒的組件
--react-native標誌使用React-native-SVG庫創建組件
--color標誌創建了帶有SVG兒童填充道具的顏色道具的反應本地組件
--typescript標誌將使用打字稿導入語句,例如( import * as React )
--coffeescript標誌將使用Coffeescript CJSX語法來創建組件
筆記:
如果未設置默認參數,則當前工作目錄將用作.svg文件的路徑,並在./svg目錄中輸出。
包含.svg文件的子目錄將在輸出路徑中的子目錄中生成其相應的反應組件。
輸出路徑包含導出所有生成組件的索引。
在JSX/TSX/CJSX文件中使用生成的組件:
[ ... ]
import Pic from './svgComponents/Pic'
class MyComponent extends Component {
render ( ) {
return (
< div >
< Pic width = { 300 } height = { 100 } />
< p > Lorem ipsum... </ p >
</ div >
) ;
}
}
[ ... ]