Last Updated: February 25, 2016
·
597
· rsl

Separating manifests and 'source' files in Rails' asset pipeline

I really don't like trying to sort through the list of files in the app/assets/javascript [or css] so I've taken to using kind of the reverse notation of Rails' partial templates. All my manifest files start with a single underscore which simultaneously makes them easy to spot as being manifests and puts them at the top of the directory listing as well.

You do have to manually whitelist these files in your production.rb file. I usually do something like:

config.assets.precompile += Dir.entries('app/assets/javascripts').select{|entry| entry.start_with?('_')}
config.assets.precompile += Dir.entries('app/assets/stylesheets').select{|entry| entry.start_with?('_')}

Have a fresh tip? Share with Coderwall community!

Post
Post a tip