How icon IDs and CSS selectors are generated
masterBy default, icon names and CSS class names are generated from a slug of the relative path + basename of each .svg file found in the input directory. This allows you to organize icons into namespaces using folders.
Example Structure:
icons
├── logo.svg
└── social
└── facebook.svgResulting Mapping:
- Icon ID:
logo$\rightarrow$ CSS Selector:.icon-logo(assuming prefixiconand tagi) - Icon ID:
social-facebook$\rightarrow$ CSS Selector:.icon-social-facebook
You can override this behavior by providing a getIconId function in your configuration file. The function receives an object containing:
basename: The filename without extension (e.g.,'foo').relativeDirPath: The path relative to the input directory (e.g.,'sub/dir').absoluteFilePath: The full absolute path.relativeFilePath: The path relative to the input directory including filename (e.g.,'sub/dir/foo.svg').index: The zero-based index of the icon.