3

I'm using the following grunt tasks

grunt-sass grunt-contrib-watch grunt-autoprefix node-bourbon

(there are a few other tasks, such as uglify, spritesmith, and haml, which i have left out of this example)

My grunt file looks like this:

module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    sass: {
        options: {
            sourceMap: true,
            outputStyle: 'compressed',
            imagePath: 'assets/css/img',
            includePaths: require('node-bourbon').includePaths
        },
        dist: {
            files: {
                'assets/css/app.css': 'assets/sass/app.scss'
            }
        }
    },

    autoprefixer: {
      options: {
         browsers: ['last 2 version', 'ie 8', 'ie 9'],
         silent : false
      },
      dev: {
        src: 'assets/css/app.css',
        dest: 'assets/css/post.css'
      },
    },

    watch: {
      options: {
          livereload: true
      },
      sass: {
        files: ['assets/sass/**/*.scss', 'assets/sass/*.scss'],
        tasks: ['sass:dist', 'autoprefixer:dev']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-autoprefixer');

  grunt.registerTask('default', ['watch', 'sass']);

};

This is working. However, if there is an error in my sass file nothing is reported. For instance if I try and use an $variable that doesn't exist, no errors are reported in my terminal

Here are two subsequent logs, the first compiles successfully with no errors. The second doesn't compile (as there is an undefined variable in the scss file)

Completed in 1.712s at Sun Sep 28 2014 15:23:17 GMT+0100 (GMT Daylight Time) - Waiting...
>> File "assets\sass\app.scss" changed.
Running "sass:dist" (sass) task
File assets/css/app.css created.
File assets/css/app.css.map created.

Running "autoprefixer:dev" (autoprefixer) task
File assets/css/post.css created.

Done, without errors.

C:\wamp\www\_bp2>grunt
Running "watch" task
Waiting...
>> File "assets\sass\app.scss" changed.
Running "sass:dist" (sass) task
Completed in 1.656s at Sun Sep 28 2014 15:29:25 GMT+0100 (GMT Daylight Time) - Waiting...

Does anyone know why no errors are being logged?

I'm in the process of rebuilding my sass boilerplate to use libsass and bourbon instead of compass. So I'm expecting to come across loads of errors during the process, so I really need to know what these errors are.

Thanks

magicspon
  • 926
  • 2
  • 9
  • 28

0 Answers0