chamnap / themes_on_rails

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

Include default assets in themes #22

Closed luisfontes19 closed 9 years ago

luisfontes19 commented 9 years ago

By default, scripts images and styles in assets folder should be loaded... For example, I have a chart.js in my asset folder, that will be used independent of the theme... I should't need to put a copy on each theme...

Is there a workaround for this?

dansbits commented 9 years ago

You can include your default assets in your theme's layout just as you would outside of your theme:

<%= javascript_include_tag :application %>  # default assets
<%= javascript_include_tag "your_theme/all" %> # theme assets
luisfontes19 commented 9 years ago

Thats perfect, thanks

Great gem, by the way

louman commented 8 years ago

Sorry for reopening this issue, but what about images?

Let's say I want to have a set of default images and only want to overwrite some in my theme. Is there a way to achieve this and still use:

# looks for the image in assets/images/default and mytheme/assets/images 
<%= image_tag 'image.jpg' %>

Is that possible?

chamnap commented 8 years ago

@louman, Is not possible. However, you can write a small rails helper in this case on your own. I don't want to touch the rails api.