How to speed up sass compilation?

When compiling sass, I usually have a very long compilation time (up to 9 seconds in the current medium-sized project) on my very fast laptop with ssd. I use sass through the grunt-contrib-sass search task, but the compilation time is not much different when running sass directly from the command line. Libsass , on the other hand, is only about 100 ms for the same project, but it does not support several functions that I need. So I would like to know what features I need to speed up the compilation process?

Separating files helps, of course, but are there other ways to do this with less side effects?

Edit: Also, I would also be happy to explain how libsass can be much faster than ruby. For some reason, I doubt very much that this is simply because ruby ​​is much slower than C / C ++. Or am I wrong here?

Edit2: Although I use Ubuntu, the same project compiled in 2 seconds on macbook pro, which is supposed to be slower when it comes to hardware, so it might be related to Linux somehow.

+8
ruby sass ubuntu gruntjs gulp
source share
1 answer

What I have found out so far:

  • change in ruby ​​version: I had ruby ​​2.1.2 and sass 3.3.8 (current last stables). After deleting all previous (unused?) Sass versions, I had a speed increase of 1 second. Installing ruby ​​1.9.3 and then 2.0.0 will compile everything in about 2 seconds (for both versions of ruby). :) I'm still ready for further suggestions.

Grunt only:

  • update-autoprefixer: If you use grunt-autoprefixer , I highly recommend that you update it to the latest version (1.0.0 atm). I had an increase in speech from 13 to 4 seconds in one of my projects. The update also fixes a problem with damaged source cards.

  • use jit-grunt instead of load-grunt: tasks . If you are using grunt-load-tasks, consider using jit grunt . There is significant increse speed.

+3
source share

All Articles