Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I have to run rake assets:clean before rake assets:precompile?

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?

like image 478
Damon Aw Avatar asked Aug 24 '12 04:08

Damon Aw


People also ask

How do you Precompile an asset?

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.

What does rake assets Clean do?

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.

How does Rails asset pipeline work?

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.


1 Answers

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

like image 135
Kyle C Avatar answered Oct 04 '22 13:10

Kyle C