Skip to content

Instantly share code, notes, and snippets.

@kpunith8
Last active October 3, 2023 12:28
Show Gist options
  • Save kpunith8/189ce5e09a702eb21ddcafc737dfd20f to your computer and use it in GitHub Desktop.
Save kpunith8/189ce5e09a702eb21ddcafc737dfd20f to your computer and use it in GitHub Desktop.
Mac Tips

Links the inkscape CLI from Applications folder to /usr/local/bin

https://stackoverflow.com/questions/22085168/inkscape-command-line-where-is-it-on-mac

ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape /usr/local/bin/inkscape

Discovered this while convering the strokes to svg path, https://github.com/leifgehrmann/svg-stroke-to-path

Converting Strokes in a SVG to paths

I faced an issue with exported SVG from Figma it had strokes but the fontforge lib won’t work with SVGs having a stroke, I had to convert those strokes to path using the Sketch tool as it was mentioned in the README.md in the dingbats project, which says

Make sure all the paths of the icons are not strokes. If there is a stroke (i.e. some border styles) convert it to path (aka Vectorize) using Sketch / Layer / Convert to Outlines menu. If not done, the fontforge won't create a glyph and the icon will be broken, even if an exported SVG file renders correctly.

In the latest version of Sketch I don’t see the option Convert to Outlines option (which was present in the older version though and I didn’t see an alternative option for the same looking online.

I found an solution using inkscape tool, with the help of this little script https://github.com/leifgehrmann/svg-stroke-to-path I was able to convert all the strokes in the SVG.

Here are the steps for those who face the similar issue in future,

  1. Install the inkscape app
  2. Link the CLI installed in Applications to /usr/local/bin folder using the below command
$ ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape /usr/local/bin/inkscape
  1. Clone the https://github.com/leifgehrmann/svg-stroke-to-path package
  2. Move your .svg icon to the cloned folder (or use the relative path to invoke the script)
  3. Run this command to convert all the strokes (Refer the documentation for more help)
$ ./svg-stroke-to-path all myFile.svg

And also exported SVG from figma was very small (16x19) and I did use the Scale option in the Sketch to have the desired size of 200x200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment