在我们的项目中(>100,000行CSS),我们成功地从grunt-contrib-compass转向使用grunt-sass和compass-mixins的组合,这些工具都是使用libsass而非ruby版本。这种方式既能得到compass的所有魔力,又能够提高编译时间性能,我们将编译时间从40秒以上缩短至500-600毫秒。一定要尝试一下。
更新2
这里有一个node模块,可以自动将上述库引入你的grunt环境中:
https://github.com/haithembelhaj/compass-importer
更新
创建一个针对libsass的端口显然在创建者的计划中:https://github.com/Compass/compass/issues/1916
bower install compass-sass-mixins
@import "bower_components/compass-sass-mixins/lib/compass"
npm i compass-sass-mixins
@import "node_modules/compass-sass-mixins/lib/compass"
https://github.com/askucher/compass-sass-mixins
grunt-contrib-compass
并安装了grunt-sass
和compass-importer
。甚至不需要更改我的 scss 中的任何一行代码。 - GFoley83