Search code examples
gulpcompassgulp-compass

Prevent intermediate compass file output when piping


I'm using gulp-compass to compile scss files. However, I'm concatenating output into a single file.

This all works fine, but I'm noticing that compass itself is writing the individual files to the output directory.

I'm left with the individual files, as well as the concatenated result.

Is there any way to prevent that intermediate output?

gulp.task('compass:dev', function() {
    return gulp.src(appPath + '/**/*.scss')
        .pipe(plugins.compass({
            css: distPath + '/css',
            sass: appPath
        }))
        .pipe(plugins.concat('app.css'))
        .pipe(gulp.dest(distPath + '/css'));
});

Solution

  • As mentioned before, gulp-compass has been blacklisted by the Gulp developers for violating against some "plugin rules" which have been established (for instance: you have to redefine input and output). Which means that you really, really shouldn't use it. However, gulp-ruby-sass as an option for allowing you to use compass imports. Consider this:

    var sass = require('gulp-ruby-sass');
    
    gulp.task('compass:dev', function() {
        return sass(appPath + '/**/*.scss', { compass: true})
            .pipe(plugins.concat('app.css'))
            .pipe(gulp.dest(distPath + '/css'));
    });
    

    Depending on your setup, there still might be breaks.