My understanding of new Rails 3.1 asset pipeline in production mode is as follows:->
"https://mybucket.s3.amazonaws.com"
app/assets
are checked into repopublic/assets
is NOT checked into repoWith all the above, I thought Rails would look for all the assets on S3 and I don't need them in the repository. Or at least I don't need the precompiled assets in public/assets
in the repo.
I have found this, on heroku, if don't have config.assets.compile = true
, it flat out will not find the precompiled assets on S3. And heroku must run through a compiling phase for all assets, but then will server them out of S3. Running heroku run rake assets:precompile
doesn't do squat. The production process will re-compile everything again.
Huh? That makes no sense to me.
I would make sense to me that you do not need to fill your repo with images, let your CDN do the work.
I have a feeling this is incorrect. Am I right or wrong?
To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.
rake assets:clean removes compiled assets. It is run by cap deploy:assets:clean to remove compiled assets, generally from a remote server.
The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB. Prior to Rails 3.1 these features were added through third-party Ruby libraries such as Jammit and Sprockets.
When you have this set:
config.assets.compile = false
no requests for assets will be passed to Sprockets to be served. It is expected that the files will be precompiled somewhere.
Check out the asset pipeline setup guide on the Heroku site as there is a special setup to get it working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With