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.
Last active
August 29, 2015 13:56
-
-
Save swrobel/8856129 to your computer and use it in GitHub Desktop.
Precompile assets locally but keep the manifest files in source control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public/assets*/* | |
!public/assets*/manifest*.json | |
!public/assets*/manifest*.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set a different path for non-production assets | |
config.assets.prefix = "/assets_#{Rails.env}" unless Rails.env.production? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['COMPILE_ASSETS'] | |
# If Rails 3, use: | |
config.assets.compress = true | |
# If Rails 4, use: | |
config.assets.js_compressor = :uglify | |
config.assets.css_compressor = :sass | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment