0

I'm trying to pass in an array of directories containing Sass files to be compiled into a single CSS file. The array of directories looks like the correct approach but I'm getting an error message as follows:

Individual stylesheets must be in the sass directory.
[09:54:41] Plumber found unhandled error:
 Error in plugin 'gulp-compass'
Message:
    Compass failed

My guplfile.js is as follows:

var gulp = require('gulp'),
    compass = require('gulp-compass'),
    watch = require('gulp-watch'),
    notify = require('gulp-notify'),
    debug = require('gulp-debug'),
    plumber = require('gulp-plumber'),
    sourcemaps = require('gulp-sourcemaps'),
    runSequence = require('run-sequence');

var config = {
    sass: {
        files: [
            'css/**/*.scss',
            '../mytheme/css/**/*.scss'
        ],
        includePaths: [
            'node_modules'
        ],
        outputStyle: {
            watch: 'expanded',
        },
        outputPath: 'build/css'
    }
};

gulp.task('sass', function () {
    return gulp.src(config.sass.files)
        .pipe(plumber())
        .pipe(debug({title: 'Debug:'}))
        .pipe(compass({
            sass: 'css',
            css: config.sass.outputPath,
            debug: true,
            import_path: config.sass.includePaths,
            style: config.sass.outputStyle.watch,
            sourcemap: true
        }))
        .pipe(sourcemaps.write())
        .pipe(notify('Compiled: <%= file.relative %>!'));
});

/**
 * Default task
 */
gulp.task('default', ['watch']);

if I remove the second location in the files array, then gulp compiles without issue. So it's just how to allow that second location to be compiled - assume I need to do something more with sass: 'css' and/or css: config.sass.outputPath.

Any help greatly appreciated.

tomphilps
  • 159
  • 1
  • 3
  • 10
  • 1
    I think compass can only look in a single folder. You might try `gulp-sass` and `gulp-autoprefixer` or you could try passing an array into the `compass.sass` option, but I think that can only take a string. – jassok Dec 04 '17 at 15:51
  • @jassok - yep looks like you're right, i'll prob do as you suggest and just switch to gulp-sass – tomphilps Dec 04 '17 at 23:42
  • For what its worth, I made the switch from compass to sass and autoprefixer for this very reason (and because compass was becoming really slow building stylesheets). If you run into any issues, I can share some examples of what I've done in my gulp files. – jassok Dec 05 '17 at 18:45

0 Answers0