Reputation: 3049
I'm currently working on a Rails 4.2.6 application. In the styles sheet folder I have sub directories that represents part of the the application, as shown in the image below:
In the config/initializers/assets.rb file I have the following code:
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( faq_page/faq.css )
Rails.application.config.assets.precompile += %w( contact/new.css )
I have to add each file in order to precompile the assets. I tried using the following code config.assets.precompile = ['*.js', '*.css']
but it didn't work. I get the following error
Sass::SyntaxError in Pages#home
How can I precompile the assets with a wildcard without having to add each .css
file to assets.rb?
Upvotes: 0
Views: 907
Reputation: 6952
Everything in your /assets
folder should automatically be included in the asset pipeline. You should be able to remove config.assets.precompile = ['*.js', '*.css']
from your assets initializer altogether.
The only time you should have to add to config.assets.precompile
is when you want to add assets from a directory such as /vendor
Upvotes: 1