diff --git a/README.md b/README.md index cd25e99..6fe1a37 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ icon "check", stroke_width: 2 ## First-party libraries +- [Feather](https://github.com/feathericons/feather) - [Heroicons](https://github.com/tailwindlabs/heroicons) - [Lucide](https://github.com/lucide-icons/lucide) - [Tabler](https://github.com/tabler/tabler-icons) diff --git a/lib/generators/rails_icons/initializer_generator.rb b/lib/generators/rails_icons/initializer_generator.rb index b4563f5..8605687 100644 --- a/lib/generators/rails_icons/initializer_generator.rb +++ b/lib/generators/rails_icons/initializer_generator.rb @@ -34,6 +34,7 @@ def insert_configuration def library_configuration configs = { + feather: feather_config, heroicons: heroicons_config, lucide: lucide_config, tabler: tabler_config, @@ -43,6 +44,15 @@ def library_configuration libraries.map { configs[_1.to_sym] }.join("\n") end + def feather_config + <<~RB.indent(2) + # Override Feather defaults + # config.libraries.feather.outline.default.css = "size-6" + # config.libraries.feather.outline.default.stroke_width = "2" + # config.libraries.feather.outline.default.data = {} + RB + end + def heroicons_config <<~RB.indent(2) # Override Heroicon defaults diff --git a/lib/rails_icons/configuration.rb b/lib/rails_icons/configuration.rb index 1ba2c8d..229ec11 100644 --- a/lib/rails_icons/configuration.rb +++ b/lib/rails_icons/configuration.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "configuration/animated" +require_relative "configuration/feather" require_relative "configuration/heroicons" require_relative "configuration/lucide" require_relative "configuration/tabler" @@ -37,6 +38,7 @@ def set_libraries_config @config.libraries = ActiveSupport::OrderedOptions.new @config.libraries.animated = Configuration::Animated.new.config + @config.libraries.feather = Configuration::Feather.new.config @config.libraries.heroicons = Configuration::Heroicons.new.config @config.libraries.lucide = Configuration::Lucide.new.config @config.libraries.tabler = Configuration::Tabler.new.config diff --git a/lib/rails_icons/configuration/feather.rb b/lib/rails_icons/configuration/feather.rb new file mode 100644 index 0000000..715cd35 --- /dev/null +++ b/lib/rails_icons/configuration/feather.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module RailsIcons + class Configuration + class Feather + def config + ActiveSupport::OrderedOptions.new.tap do |options| + setup_outline_config(options) + end + end + + private + + def setup_outline_config(options) + options.outline = ActiveSupport::OrderedOptions.new + options.outline.default = default_outline_options + end + + def default_outline_options + ActiveSupport::OrderedOptions.new.tap do |options| + options.stroke_width = "2" + options.css = "size-6" + options.data = {} + end + end + end + end +end diff --git a/lib/rails_icons/libraries.rb b/lib/rails_icons/libraries.rb index 9384b93..8e909d8 100644 --- a/lib/rails_icons/libraries.rb +++ b/lib/rails_icons/libraries.rb @@ -4,6 +4,14 @@ module Libraries def all { + feather: { + name: "feather", + url: "https://github.com/feathericons/feather.git", + variants: { + outline: "icons" + } + }, + heroicons: { name: "heroicons", url: "https://github.com/tailwindlabs/heroicons.git", @@ -15,6 +23,14 @@ def all } }, + lucide: { + name: "lucide", + url: "https://github.com/lucide-icons/lucide.git", + variants: { + outline: "icons" + } + }, + tabler: { name: "tabler", url: "https://github.com/tabler/tabler-icons.git", @@ -22,14 +38,6 @@ def all filled: "icons/filled", outline: "icons/outline" } - }, - - lucide: { - name: "lucide", - url: "https://github.com/lucide-icons/lucide.git", - variants: { - outline: "icons" - } } } end diff --git a/test/dummy/app/assets/svg/icons/feather/outline/activity.svg b/test/dummy/app/assets/svg/icons/feather/outline/activity.svg new file mode 100644 index 0000000..f4bce75 --- /dev/null +++ b/test/dummy/app/assets/svg/icons/feather/outline/activity.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/icon_test.rb b/test/icon_test.rb index cfa2761..6740965 100644 --- a/test/icon_test.rb +++ b/test/icon_test.rb @@ -34,6 +34,12 @@ class IconTest < ActiveSupport::TestCase end end + test "using feather library, it returns a SVG" do + assert_nothing_raised do + icon("activity", library: "feather") + end + end + test "using lucide library, it returns a SVG" do assert_nothing_raised do icon("graduation-cap", library: "lucide")