Pregunta

Every time I pull code into my repository after making changes to JS or CSS files, I run the following commands:

rake assets:clean
rake assets:precompile

I've got quite a bit of assets, so this process always takes at least a minute. Is there any way to get it to go faster? For example, if I've only changed CSS, is there a way to tell it to only focus on CSS files and not to bother cleaning and precompiling JS?

Edit: Oops, I should have specified that this is on production. I'm aware I don't need to precompile assets on development :)

¿Fue útil?

Solución

I am assuming that you are running Rails >3.1.

Don't run the rake tasks at all. Rails development mode doesn't need the assets to be precompiled. Rails will automagically compile the assets when there is a change else it will not.

If you are looking for performance while serving assets in development you can look the gems such as https://github.com/wavii/rails-dev-tweaks

Otros consejos

This an add-on not pretending to be an answer.

Process monitor in Windows shows that ruby.exe makes cycles while doing assets:precompile and in each cycle it queries all the gems installed again and again.

Rails 3.2.1

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top