chamnap / themes_on_rails

Adds multi themes support to your Rails 3/4/5 application
https://rubygems.org/gems/themes_on_rails
MIT License
218 stars 86 forks source link

Gem in an engine #19

Open Svashta opened 9 years ago

Svashta commented 9 years ago

Hi,

i am trying to use this gem inside an egine in my application. How can i use it as it seems it is always searching inside root app paths, not my engine paths.

Is there any way to tell where it starts searching from?

Svashta commented 9 years ago

I've managed to change prefix_path via custom initializer, which is OK, but styles and javascripts are not loaded as expected. If i look at themes_on_rails_example and how the stylesheet_link_tag is generated it is a little bit different. In examples it goes to /assets/theme/all In my case it is /stylesheets/theme/all - which can't be found.

Any ideas?

Svashta commented 9 years ago

Figured out the problem is in engine.rb initializers which also have paths defined. I am now currently overriding them in my engine, but feels fugly. Is there a more elegant way to do it? Maybe to extend the gem to allow passing in an option for default path?

Svashta commented 9 years ago

Adding additional engine complicates things even more. Paths in gem are partially hardcoded which makes stuff non usable.

I have tried to overwrite paths in second engine, too, but either first engine or second engine paths work. The funny thing is i can see paths in views search on error, but something goes wrong non the less.

I would really appreaciate some tips on how i could use the gem with mountable engines and modular way.