svg-icon-font-generator
v1.1.7
Published
Convert SVG icons to webfonts + CSS with a CLI or API
Downloads
28
Maintainers
Readme
SVG Icon Font Generator
This project is a simple tool for generating icon fonts from a collection of SVG icons. It uses webfonts-generator to generate the font files (e.g., .woff, .woff2, .ttf,) and a corresponding CSS file for easy integration into web projects.
Project Structure
svg-icon-font-generator/ ├── bin/ │ └── build-icon-font.js # Main CLI entry to generate font & CSS ├── icons/ │ └── eurofins-icons/ │ ├── svg-icons/ # Folder containing raw .svg icon files │ ├── css/ # Folder for the generated CSS file │ ├── fonts/ # Folder for the generated font files (woff, woff2, ttf) ├── src/ # Source code for the generator ├── iconfont-style-template.hbs # Handlebars template for CSS output ├── package.json # Project dependencies and scripts └── README.md # Project documentation
Prerequisites
- Node.js and npm installed on your system.
- Install webfonts-generator` library
- You should have a folder containing your SVG icons.
Key Updates Based on Code:
Output directories for fonts and CSS: The
generateFontfunction ensures that the font files (woff,woff2,ttf) are generated in afonts/directory and the CSS file in acss/directory.Webfonts Generator: The
webfonts-generatorlibrary is used to create the font files from the SVG files. The CSS references these font files using relative paths like../fonts.SVG File Processing: The SVG files are prefixed with numeric indexes to avoid name collisions and ensure the generated fonts and CSS are correctly mapped.
