komposable / komponent

An opinionated way of organizing front-end code in Ruby on Rails, based on components
http://komponent.io
MIT License
426 stars 31 forks source link

Set load path from gem instead of using install generator #139

Open Spone opened 5 years ago

Spone commented 5 years ago

Following #121 and #136, what about calling this line:

config.paths.add "frontend/components", eager_load: true

directly from the gem instead of adding it to config/application.rb when running the install generator.

Let's make a list of advantages and potential drawbacks!

florentferry commented 5 years ago

If you load it directly from gem, you loose advantage of changing default root path (https://github.com/komposable/komponent#change-default-root-path). But maybe not an issue to remove that option ?

Spone commented 5 years ago

Can't we use the Rails.application.config.komponent.root value in config.paths.add in case it's called from the gem?

nicolas-brousse commented 4 years ago

It's what https://github.com/komposable/komponent/blob/eb4267b40f927ab2cad840d644353d38a9e36a60/lib/komponent/engine.rb#L55 does, no?