Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Precompile assets locally but keep the manifest files in source control

This setup will allow you to precompile assets locally and keep them separated depending on the environment. To precompile assets locally run RAILS_ENV=production COMPILE_ASSETS=1 rake assets:precompile. Using an ENV var like this removes the need for having therubyracer or some other javascript engine on your server instances since they aren't actually running the precompilation task.

# Set a different path for non-production assets
config.assets.prefix = "/assets_#{Rails.env}" unless Rails.env.production?
# If Rails 3, use:
config.assets.compress = true
# If Rails 4, use:
config.assets.js_compressor = :uglify
config.assets.css_compressor = :sass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment