SVG convertor to import as icon
-
SVG Formatter
https://quasar.dev/vue-components/icon#svg-icon-format
Do we have a script somewhere that does this conversion automatically?
I mean, paste the <svg> code, click ‘submit’, then get the icon-ready string for import. -
@ncamaa No, but I have been thinking we could create a cli for this…
-
@ncamaa I wrote a tool for that last weekend. svg-stringifier
-
@lazaroofarrill Thanks! Can you explain more about the usage for noob users? Readme wasn’t clear enough for me.
-
That what I get after installing:
zsh: command not found: svg-stringify
-
@ncamaa normal install is for running from package.json if you want to run it from command line install it globally.
-
-
@ncamaa after installing you pass as first argument to the executable the directory containing your svg icons. It will create inside that directory a js file containing an object with the string versions of the icons.
-
Thanks a lot, @labarberabarber. It works now. does it support all of the attributes or just the
d
and theviewBox
? -
@ncamaa I don’t know the svg specification very well, right now it supports the style and transforms tag. I’ll implement separated style properties later. If you find it doesn’t work for a particular icon, let me have it so I can figure out where I got it wrong.