Posted over 2 years ago. Visible to the public.
Rails Asset Pipeline: Building an Icon Font from SVG Files
Webpacker can automatically create an icon font from SVG files, which is really handy. When you're using the asset pipeline, you can still have an icon font from SVG files, but it requires some manual work.
- Install the NPM package
icon-font-generator. If you're not using
sudo npm install -g icon-font-generator
- Put all SVG icons for the font into their own directory.
- The icon name will be taken from the SVG file name
- Download the attached script and update the
- Run it
- Turn the CSS and JSON output into usable styles for your application
- Inspecting SVG files:
- Inspecting TTF or WOFF fonts:
- Resizing SVG files: