Icona asset generator
yarn add -D @icona/generator
import { generate } from "@icona/generator";
generate({
config: {
svg: {
active: true, // you can disable svg generator if you set false
path: "svg", // will generate svg files in svg folder
svgoConfig: {},
},
drawable: {
active: true, // you can disable drawable generator if you set false
path: "drawable", // will generate xml files in drawable folder
svg2vectordrawableConfig: {},
defaultColor: "#000000", // default color for android vector drawable
},
pdf: {
active: true, // you can disable pdf generator if you set false
path: "pdf", // will generate pdf files in pdf folder
pdfKitConfig: {},
svgToPdfOptions: {},
},
react: {
active: true, // you can disable react generator if you set false
path: "react", // will generate react component files in react folder
svgrConfig: {},
},
png: {
active: false,
genMode: "recreate",
path: "png",
},
font: {
genMode: "recreate",
active: true,
svgToFontOptions: {
src: "svg",
dist: "font",
fontName: "seed-icon",
},
},
flutter: {
active: true,
ttfPath: "font/seed-icon.ttf",
fileName: "SeedIcons",
fontFamily: "SeedIcon",
genMode: "recreate",
path: "flutter",
},
},
});
@icona/generator
use several libraries to generate assets.
- svgo (SVG)
- svg2vectordrawable (XML)
- pdfkit (PDF)
- svg-to-pdfkit (PDF)
- svgr (React Components)
- svgtofont (Font Files)
- opentype.js (Flutter Icons)
you configure each library options in config
object.
If you want to see real example, you can see here (seed-icon)