Using libsass with compass
Asked Answered
B

2

17

Exactly as the title says. Compilation times over 50 seconds are unacceptable. So, is there a way, let's say: a single (partial) file with compass magic (like sprite mixins, etc.), and the rest of files with pure sass?

I'm considering moving to less (reference importing), and substituting all compass tricks with additional grunt tasks, but I'm more comfortable around sass than less.

I saw those tickets, but I hoped there would be a way to compile a single file with compass, and the rest to be merged with libsass (I sometimes use sass 3.3 syntax, but if I can gain better compile times I can revert to 3.2).

Did anyone succeed in such configuration?

Brittaniebrittany answered 28/9, 2014 at 19:6 Comment(0)
T
36

In our case (>100.000 LoCSS), we succesfully moved from grunt-contrib-compass to a combination of

grunt-sass

which is using libsass instead of the ruby version, and to get all the magic from compass, we included

compass-mixins

and it worked just fine. You should definitely try it out, we reduced our compilation time from more than 40sec down to just 500-600ms.


UPDATE 2

Here's a node module that automagically imports the lib mentioned above into your grunt enviroment:

https://github.com/haithembelhaj/compass-importer

UPDATE

Creating a port to libsass is clearly on the creators mind: https://github.com/Compass/compass/issues/1916

Teillo answered 29/10, 2014 at 10:17 Comment(4)
Yup, that's the direction I'm heading. Though things like sprite generation have to be replaced with other toolsBrittaniebrittany
Absolutely blew my mind when this worked for me, with literally no changes other than removing compass and getting 5 seconds back in terms of compile-time.Midship
Upvote for the poor soul who has to maintain 100k lines with 40 seconds of compilation.Arabel
Just made the front-end devs day with this one. Removed grunt-contrib-compass & installed grunt-sass and compass-importer. Didn't even need to change a single line in my scss.Tripterous
G
1

This is answer for sass files (not scss). Please always differentiate them

  1. Run in shell bower install compass-sass-mixins
  2. Edit your sass file @import "bower_components/compass-sass-mixins/lib/compass"

or

  1. Run in shell npm i compass-sass-mixins
  2. Edit your sass file @import "node_modules/compass-sass-mixins/lib/compass"

List of functions: https://github.com/askucher/compass-sass-mixins

Grubman answered 17/10, 2015 at 9:40 Comment(1)
it doesn't matter which file-extension you use, it works for both.Teillo

© 2022 - 2024 — McMap. All rights reserved.