0

Rails 3.2 asset precompiling appends the filename with a hash. I would like to use some of my assets outside of rails ( for a maintenance page ) I would like to include some .JS files from the precompiled asset folder.

Is there a way exclude certain files from the md5 hash that's appending to the filename? Or otherwise make them available.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Rubytastic
  • 15,001
  • 18
  • 87
  • 175

1 Answers1

1

You'll find something like this in config/environments/production.rb:

# Precompile additional assets (application.js, application.css, and all
# non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )

You should add any assets you want to be able to link to individually, or additional manifest files, to the config.assets.precompile array.

For example, you could make a maintenance.js manifest file containing:

//= require foo
//= require bar

Add it to config.assets.precompile:

config.assets.precompile += %w( maintenance.js )

And then on your maintenance page:

<%= javascript_link_tag 'maintenance' %>

See the precompiling assets section in the asset pipeline guide for more information.

georgebrock
  • 28,393
  • 13
  • 77
  • 72