Ionic serve SASS error handling


#1

Hi! I’m having an issue with the Ionic CLI that I hope someone can shed some light on. Whenever there’s an error in my SASS file, this error appears in the terminal:

/Users/[path]/node_modules/gulp-util/lib/PluginError.js:53
  if (!this.message) throw new Error('Missing error message');
                           ^
Error: Missing error message
    at new PluginError (/Users/[path]/node_modules/gulp-util/lib/PluginError.js:53:28)
    at DestroyableTransform.logError (/Users/[path]/node_modules/gulp-sass/index.js:175:17)
    at DestroyableTransform.emit (events.js:129:20)
    at onwriteError (/Users/[path]/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:347:10)
    at onwrite (/Users/[path]/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:365:5)
    at WritableState.onwrite (/Users/[path]/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:124:5)
    at afterTransform (/Users/[path]/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:84:5)
    at TransformState.afterTransform (/Users/[path]/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:59:12)
    at errorM (/Users/[path]/node_modules/gulp-sass/index.js:130:14)
    at Object.callback (/Users/[path]/node_modules/gulp-sass/index.js:141:18)

This breaks the gulp task, and it has to be restarted each time. (I’m clumsy with my colons and semi-colons in SASS, so it’s happening quite often.)

A similar topic was created last summer, but with a different error: Improve gulp on error …and the linked blog post that was posted as a solution no longer seems to apply: http://blog.ionic.io/fixing-a-broken-sass-build-stream/

My project was created in early February '16, and I just came back to it after a hiatus. Here’s what the SASS section of the gulp file looks like (I added the autoprefixer, but it doesn’t seem to be the culprit here):

gulp.task('sass', function(done) {
  gulp.src('./scss/ionic.app.scss')
    .pipe(sass())
    .on('error', sass.logError)
    .pipe(gulp.dest('./www/css/'))
    .pipe(autoprefixer({
      browsers: ['last 2 versions'],
      cascade: false
    }))
    .pipe(gulp.dest('./www/css/'))
    .pipe(minifyCss({
      keepSpecialComments: 0
    }))
    .pipe(rename({ extname: '.min.css' }))
    .pipe(gulp.dest('./www/css/'))
    .on('end', done);
});

Any suggestions?