Class: Anyicon::Configuration
- Inherits:
-
Object
- Object
- Anyicon::Configuration
- Defined in:
- lib/anyicon/configuration.rb
Overview
Example usage:
Anyicon.configure do |config|
config.add_collections(
custom_collection: {
repo: 'user/repo',
path: 'path/to/icons',
branch: 'main'
}
)
end
The class also allows setting additional configuration options such as ‘default_class`, which can be used to apply a default CSS class to every icon.
Constant Summary collapse
- DEFAULT_COLLECTIONS =
A hash containing the default icon collections. Each collection specifies the repository, path, and branch where the icons can be found.
{ fontawesome_regular: { repo: 'FortAwesome/Font-Awesome', path: 'svgs/regular', branch: '6.x' }, fontawesome_solid: { repo: 'FortAwesome/Font-Awesome', path: 'svgs/solid', branch: '6.x' }, fontawesome_brands: { repo: 'FortAwesome/Font-Awesome', path: 'svgs/brands', branch: '6.x' }, heroicons_outline: { repo: 'tailwindlabs/heroicons', path: 'optimized/24/outline', branch: 'master' }, heroicons_solid: { repo: 'tailwindlabs/heroicons', path: 'optimized/24/solid', branch: 'master' }, tabler_icons_filled: { repo: 'tabler/tabler-icons', path: 'icons/filled', branch: 'main' }, tabler_icons_outline: { repo: 'tabler/tabler-icons', path: 'icons/outline', branch: 'main' }, mage_icons_fill: { repo: 'Mage-Icons/mage-icons', path: 'svg/bulk', branch: 'main' }, mage_icons_stroke: { repo: 'Mage-Icons/mage-icons', path: 'svg/stroke', branch: 'main' }, mage_icons_social_bw: { repo: 'Mage-Icons/mage-icons', path: 'svg/social-bw', branch: 'main' }, mage_icons_social_color: { repo: 'Mage-Icons/mage-icons', path: 'svg/social-color', branch: 'main' }, line_awesome: { repo: 'icons8/line-awesome', path: 'svg', branch: 'master' }, carbon: { repo: 'carbon-design-system/carbon', path: 'packages/icons/src/svg/32', branch: 'main' }, ionicons: { repo: 'ionic-team/ionicons', path: 'src/svg', branch: 'main' }, feather_icons: { repo: 'feathericons/feather', path: 'icons', branch: 'main' } }.freeze
Instance Attribute Summary collapse
-
#collections ⇒ Hash
The configured icon collections.
Instance Method Summary collapse
- #add_collections(new_collections) ⇒ Object
-
#initialize ⇒ Configuration
constructor
Initializes a new Configuration instance with default settings.
Constructor Details
#initialize ⇒ Configuration
Initializes a new Configuration instance with default settings.
46 47 48 |
# File 'lib/anyicon/configuration.rb', line 46 def initialize @collections = DEFAULT_COLLECTIONS.dup end |
Instance Attribute Details
#collections ⇒ Hash
Returns the configured icon collections.
43 44 45 |
# File 'lib/anyicon/configuration.rb', line 43 def collections @collections end |
Instance Method Details
#add_collections(new_collections) ⇒ Object
50 51 52 |
# File 'lib/anyicon/configuration.rb', line 50 def add_collections(new_collections) @collections.merge!(new_collections) end |