Could somebody explain to me what the command rake assets:clean
really does? Unfortunately the Rails Guides dont mention it. There is also the command rake assets:cleanup
. Whats the difference?
Furthermore could somebody tell me when do I have to run rake assets:precompile
in production. Do I run it on the server console after I deployed all my application files to my production server? Or do I precompile
on my local machine and then do a deploy of all files?
Thanks all
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 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.
Run rake assets:clobber
to actually clean the assets. http://www.dixis.com/?p=735
If you precompile on your local machine, then you can commit these generated assets into the repository and proceed with deployment. No need to compile them on production machine.
But it introduces a problem: now when you change source files (coffescript / scss), the app won't pick up the changes, because it will serve precompiled files instead. rake assets:clean
deletes these precompiled files.
In my projects assets are precompiled as a part of deployment. Capistrano makes it very easy.
Also, I never heard of rake assets:cleanup
.
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