slow Grunt and compass while filling up the .scss file

192 Views Asked by At

just one question about filling up the .scss file with Grunt and compass. While filling it up, I noticed that it is a bit slow. How can I solve this problem? Thanks for your help

1

There are 1 best solutions below

0
inkovic On

There are several reasons for slow compile time when working with a Sass workflow.

  1. Too Many Imports: If you use a lot of dynamic imports (i.e. Sass Globbing) on many of your _scss files it can slow Sass down as Ruby is doing quite a lot of calculations. You will probably have to kill Sass Globbing all together and manually import individual _scss files, which would be better.
  2. Compiling Too Many Files: If you have configured your project to generate multiple style sheets (ie: no query, different layouts) this will really clog up your compilation time.
  3. Ruby is Slow: I run a Windows, so Ruby is notoriously slower then *nix systems and Macs. If Ruby is out of date, update it.
  4. You .sass-cache isn't warm: There should be a .sass-cache folder when you compile code. If there isn't for some odd reason then Sass would be generating for the first time, everytime.
  5. Disable Compass (technically, Ruby): If you aren't absolutely dependant on Compass (i.e. you aren't using Singularity/Susy, not using Globbing or Source Maps) then you really don't need it. Scrap it for LibSass which can be installed via npm install --save-dev grunt-sass. You could use Bourbon + Bitters as an alternative for compass. LibSass is lightning fast so if speed is a priority, make the switch.