gruntjs / grunt-contrib-watch

Run tasks whenever watched files change.
http://gruntjs.com/
MIT License
1.98k stars 356 forks source link

options.atBegin doesn't work #456

Open smarts opened 9 years ago

smarts commented 9 years ago

My understanding is that specifying true for options.atBegin should run all the tasks specified in the watch task when the watcher starts.

gruntfile.js

module.exports = function (grunt) {
  grunt.initConfig({
    less: {
      development: {
        files: { 'styles/main.min.css': 'styles/main.less' }
      }
    },
    watch: {
      css: {
        files: 'styles/*.less',
        tasks: 'less'
      },
      thisFile: {
        files: 'gruntfile.js'
      },
      options: {
        atBegin: true
      }
    }
  });

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

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

When i change gruntfile.js i expect the CSS file to be regenerated, which doesn't happen

FYI: Windows 8.1 - node v0.12.7 - grunt v0.4.5 - grunt-contrib-watch 0.6.1

smarts commented 9 years ago

hmm apparently it doesn't work as a global option but does at the task level. is that the desired behavior?