How to speed up pre-compilation of assets in Rails 3+?

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

rake assets:clean rake assets:precompile 

I have quite a few assets, so this process always takes at least a minute. Is there any way to make it move faster? For example, if I just changed CSS, is there a way to tell him to focus only on CSS files and not bother with JS cleanup and precompilation?

Edit: Unfortunately, I had to point out that this works. I know that I do not need to precompile assets during development :)

+4
source share
2 answers

I assume that you are using Rails> 3.1.

Do not run rake tasks at all. Rails development mode does not need assets that must be precompiled. Rails will automatically compile assets when there is a change, otherwise it will not.

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

+3
source

This addition is not intended to be the answer.

The process monitor in Windows shows that ruby.exe runs cycles when executing assets: it precompiles and in each cycle it requests all the gems installed again and again.

Rails 3.2.1

0
source

Source: https://habr.com/ru/post/1395519/


All Articles