Search code examples
sassgulpcompass-sassgulp-sass

Gulp can't seem to find compass mixins


I am trying out gulp as an alternative build tool to Grunt, to compile my scss to css, as I have heard it can be much faster.

I having problems doing even a basic compile of my scss files. I have tried using the gulp-sass, gulp-ruby-sass and gulp-compass plugins for gulp and I get pretty much the same error message every time:

error screen.scss (Line 2 of _grid.scss: Undefined mixin 'box-sizing'.)

So it looks like it is falling down as soon as it hits a compass mixin. I have ruby installed on my PC with compass version 1.0.0.alpha.19 and sass version 3.3.7.

Here is my gulpfile:

var gulp = require('gulp'),
compass = require('gulp-compass'),
sass = require('gulp-ruby-sass');

gulp.task('compass', function() {
gulp.src('../sass/UK/screen.scss')
.pipe(compass({
    css: '../css',
    sass: '../sass',
  sourcemap: true,
  style: 'compressed'
}))
.pipe(gulp.dest('../css/UK/screen.css'));
});

gulp.task('sass', function () {
  gulp.src('../sass/UK/**/*.scss')
      .pipe(sass({ style: 'compressed', sourcemap: true }))
      .pipe(gulp.dest('../css/UK'));
});

Any ideas how I tell it where my copy of compass is installed? I thought it was installed globally.


Solution

  • You right, compass should be installed globally on your system to get this work, at least easily. I recommend you to uninstall sass and compass to get something clean using

    gem uninstall sass && gem uninstall compass
    

    And then re-install them with :

    gem install sass
    gem install compass --pre
    

    And after you can define a gulp task like so

    gulp.task('compass', function () {
    
      return gulp.src('../sass/UK/screen.scss')
        .pipe(sass({ compass: true, sourcemap: true, style: 'compressed' }))
        .pipe(gulp.dest('../css/UK/screen.css'));
    
    });