Rails-Designer / rails_icons

Add any icon library to a Rails app
https://railsdesigner.com/rails-icons/
MIT License
39 stars 4 forks source link

Library design #6

Closed mattpolito closed 4 months ago

mattpolito commented 7 months ago

This is more of a discussion than an issue.

I love the idea of a common interface for the libraries but after implementing Lucide, I realized that with each new set added we'll also get bloat. I almost think the libraries should be extracted into their own gems with the icon set and config with the main gem being the interface.

That way if i want to only use heroicons, I'd add rails_icons-heroicons to my gemfile but if i wanted to have a mix i could also add rails_icons-lucide, or any additional combination.

With that design change the end user doesn't have to deal with a bunch of extra file size from items they never intend to use.

Thoughts?

avogel3 commented 7 months ago

I agree with the file bloat sentiment. I worry that splitting into multiple gems may be cumbersome for the author(s). Honestly, it would be awesome if the installation script could pull from source and vendor the icons in the parent application. This would have the added benefit of making it easier to manage changes when the icon libraries inevitably release new icons

eelcoj commented 7 months ago

I was about to bring this up, so thanks @mattpolito! It's been on my mind before creating this gem. 😬

(Edit: related, not sure if/when loading thousands of svg's, from multiple libraries, becomes an issue)

The options so far are:

  1. separate gem per icon library (https://github.com/Rails-Designer/rails_icons/issues/6#issue-2269025553)
  2. pull icons from our source (https://github.com/Rails-Designer/rails_icons/issues/6#issuecomment-2082958123)
  3. pull icons from their source (eg. most icon libraries are hosted on GitHub)
  4. …

I personally lean mostly towards option 2. Could work pretty seamlessly with an install generator (which libraries do you want? [herocions, lucide, all])

Ikariusrb commented 6 months ago

How about using rake tasks to install icon libraries? That gets rid of bloat in the gem itself, and lets each user decide which library or libraries they want to make use of. The rake tasks could pull the icons and install them into local assets. Unless you expressly want to keep the icons out of peoples git repos?

eelcoj commented 4 months ago

To all: https://github.com/Rails-Designer/rails_icons/pull/8