komposable/komponent

Set load path from gem instead of using install generator

Spone opened this issue · 3 comments

Spone commented

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!

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

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

It's what

app.config.paths.add app.config.komponent.root.to_s, eager_load: true
does, no?