A library convert svg file to font
- Convert svg to font
- Support React
- Support React Native
- Support Typescript
npm i csvg-to-font@latest --save-dev
import { defineConfig } from 'csvg-to-font';
export default defineConfig({
src: 'svg', // svg path
dist: 'dist', // output path
fontName: 'svgtofont', // font name
css: true, // Create CSS files.
outSVGReact: true,
outSVGReactNative: true, // Create React native folder
outSVGPath: true,
typescript: true,
});
-c: Config
{
...
"scripts": {
...
"svg-2-font": "csvg-to-font",
},
...
}
- You can also use a custom config file instead of
svgtofont.config.{ts,js,mjs}
. Just create<FILE_NAME>.config.{ts,js,mjs}
to build command
Exp: awesome.config.ts;
{
...
"scripts": {
...
"svg-2-font": "csvg-to-font -c awesome",
},
...
}
Gia Hung – hung.hg