If you need to exclude a file from optimization by UglifyJS when you run
rake assets:precompile, you can use this custom class. (Modify it for your own needs)
Place this class into any suitable folder (e.g.
class ConditionalUglifier < Uglifier
def really_compile(source, generate_map)
# Skip any optimization (e.g. for shims)
if source =~ /^\/\/= skip/
source.gsub!(/\/\/= ?skip(\n)*;(\n)*\z/, "")
Require it in
production.rb (if it's needed) and specify
ConditionalUglifier as your js_compressor.
config.assets.js_compressor = ConditionalUglifier.new
//= skip to the first line of any js file that you want to exclude from the optimization.
An example of shim.js:
//= require shims/classList.min
//= require shims/raf.min
//= require shims/weakmap.min