I deploy code to my production server using git. This might include changes to JS and CSS files.
Do I have to run rake assets:clean
at all before I run rake assets:precompile
? I'm worried that not cleaning the previous precompiled assets might have side effects.
This is a little silly, but my google-fu didn't find any answers. My AWS instance runs rake assets:clean
pretty slowly and I'm wondering if it's needed at all.
Also, can I replace the clean command with a simple rm -r public/assets
?
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.
The clean it removes the old versions of the precompiled assets while leaving the new assets in place. Show activity on this post. 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 and pre-processors such as CoffeeScript, Sass, and ERB.
No you do not need to run rake assets:clean before, just running rake assets:precompile will recompile your assets. It will recreate your cache busting digest and manifest.yml (which contains key/value mappings that match each asset name to its MD5 cache-busted name)
and yes you can just run rm -r public/assets
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