Project

General

Profile

Actions

Feature #44833

closed

Support 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

Added by Marius BĂLTEANU about 3 hours ago. Updated about 3 hours ago.

Status:
Closed
Priority:
Normal
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:

- name: project
  alias: projects

Updated by Marius BĂLTEANU about 3 hours ago Actions #1

  • Status changed from New to Closed
  • Resolution set to Fixed

Change committed:

  • config/icon_source.yml: document the alias key.
  • lib/tasks/icons.rake: skip entries with alias during icons:download (so no duplicate <symbol> is added to app/assets/images/icons.svg) and abort if an alias points to an unknown icon name.
  • app/helpers/icons_helper.rb: load ICON_ALIASES from config/icon_source.yml and resolve aliases in sprite_icon for 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) via sprite_icon without any changes.
Actions

Also available in: PDF Atom