Actions
Feature #44833
closedSupport icon aliases in config/icon_source.yml to avoid duplicate SVG symbols
Feature #44833:
Support icon aliases in config/icon_source.yml to avoid duplicate SVG symbols
Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Resolution:
Fixed
Description
Currently, when multiple semantic icon names in config/icon_source.yml share the same underlying Tabler SVG (for example projects/project, comments/comment/message, text-x-c/text-x-java/text-x-ruby, or upcoming semantic icon names such as wiki toolbar icons), bin/rails icons:generate downloads the same SVG multiple times and writes duplicate <symbol> definitions into app/assets/images/icons.svg.
Add support for an alias key in config/icon_source.yml so an icon name can reference an existing icon in the default sprite without duplicating its SVG markup:
Updated by Marius BĂLTEANU about 1 hour ago
- Status changed from New to Closed
- Resolution set to Fixed
Change committed:
config/icon_source.yml: document thealiaskey.lib/tasks/icons.rake: skip entries withaliasduringicons:download(so no duplicate<symbol>is added toapp/assets/images/icons.svg) and abort if an alias points to an unknown icon name.app/helpers/icons_helper.rb: loadICON_ALIASESfromconfig/icon_source.ymland resolve aliases insprite_iconfor the default sprite, while preserving theme override precedence:- If the active theme defines the alias name itself in its sprite, the theme's icon is used.
- Otherwise, the alias resolves to its target icon name (and uses the theme's override for the target if present, or falls back to the default sprite).
- Custom sprites and plugin sprites are unaffected.
/rails/info/svg_icons: continues to display all entries (including aliases) viasprite_iconwithout any changes.
Actions