Rails config.assets.precompile setting to process all CSS and JS files in app/assets

keithgaputis picture keithgaputis · Apr 11, 2012 · Viewed 38.4k times · Source

I wish to precompile all the CSS and JS files in my project's app/assets folder. I do NOT want to precompile everything in vendor/assets or lib/assets, only the dependencies of my files as needed.

I tried the following wildcard setting, but it incorrectly precompiles everything. This results in lots of extra work and even causes a compilation failure when using bootstrap-sass.

config.assets.precompile += ['*.js', '*.css']

What is my best bet to only process my files in app/assets? Thanks!

Answer

techpeace picture techpeace · Jan 31, 2013

config.assets.precompile = ['*.js', '*.css']

That will compile any JavaScript or CSS in your asset path, regardless of directory depth. Found via this answer.