Controlling Asset Precompilation in Rails

I’ve run into issues recently with precompilation after introducing new gems containing partial SASS files (Bootstrap and Font Awesome).

Rails allows you to specify patterns or Procs to determine which files should – or in our case should not – be precompiled, like this:

Rails.application.config.assets.precompile = [Proc.new {|e| !(e =~ /(font-awesome|bootstrap)\/_/) } ]