Rails config.assets.precompile for a specific subfolder

Ive got some very heavy external stylesheets in app / assets / stylesheets / external / calendars I don't want to include stylesheets in application.css as they are used infrequently

However, I want them to be precompiled.

Can I use config.assets.precompile o to selectively precompile all stylesheets in this folder?

+8
ruby-on-rails asset-pipeline
source share
2 answers

This is described in section 4.1 of the Asset Route Guide.

config.assets.precompile += ["*external/calendars*"] 
+10
source share

You can simply write it like this:

 config.assets.precompile += ['directory1/*', 'directory2/*', 'file.js'] 

Or use a cleaner syntax like:

 config.assets.precompile += %w( directory1/* directory2/* file.js ) 
+10
source share

All Articles