tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 61 forks source link

override function isn't load from config file #89

Open leosuncin opened 8 years ago

leosuncin commented 8 years ago

I have problems when use grunt-newer and grunt-contrib-compass on watch files, doesn't compile new files, well I read that I can use override function but doesn't make any effect, I didn't know why until run in verbose mode and see that override option is set to undefined.

tasks/config/newer.js

module.exports = function(grunt) {

    grunt.config.set('newer', {
        options: {
            cache: '.tmp/grunt-cache',
            override: function(detail, include) {
                grunt.verbose.writeln(detail);
                if (detail.task === 'less' || detail.task === 'compass') {
                    include(true);
                } else {
                    include(false);
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-newer');
};

tasks/config/watch.js

module.exports = function(grunt) {

    grunt.config.set('watch', {
        compass: {
            files: ['assets/styles/{,**/}*.scss'],
            tasks: ['newer:compass:dev', 'sails-linker:devStyles', 'notify:sass']
        },
        coffee: {
            files: ['assets/scripts/**/*.coffee'],
            tasks: ['newer:coffee:dev', 'sails-linker:devJs', 'notify:coffee']
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
};

Part of the output when run grunt in verbose mode Imgur