tschaub / grunt-newer

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

Watch task notices changed files, but newer seems to skip them, LESS related. #33

Closed jdhorner closed 10 years ago

jdhorner commented 10 years ago

LESS task defined as below in grunt file:

less: {
  all: {
    options: {
      strictImports: true
    },
    files: [
      {src: ['<%= am.assets %>/src/shared/less/global.less'], dest: '<%= am.dest %>/css/global.css'},
      {src: ['<%= am.assets %>/src/app/common/less/app.less'], dest: '<%= am.dest %>/css/app.css'},
      {src: ['<%= am.assets %>/src/app/taxes/less/taxes.less'], dest: '<%= am.dest %>/css/taxes.css'},
      {src: ['<%= am.assets %>/src/app/storeAdmin/less/storeAdmin.less'], dest: '<%= am.dest %>/css/storeAdmin.css'},
      {src: ['<%= am.assets %>/src/corp/less/corp.less'], dest: '<%= am.dest %>/css/amilia-corporation.css'},
      {src: ['<%= am.assets %>/src/directory/less/directory.less'], dest: '<%= am.dest %>/css/amilia-directory.css'},
      {src: ['<%= am.assets %>/src/claim/less/claim.less'], dest: '<%= am.dest %>/css/amilia-claim.css'},
      {src: ['<%= am.assets %>/src/store/less/store.less'], dest: '<%= am.dest %>/css/amilia-store.css'},
      {src: ['<%= am.assets %>/src/store/less/store-mobile.less'], dest: '<%= am.dest %>/css/amilia-store-mobile.css'},
      {src: ['<%= am.third %>/backgrid/*.css'], dest: '<%= am.dest %>/css/amilia.app-libs.css'}
    ]
  },
}

And the Grunt watch task is as below:

watch: {
  lessfiles: {
    files: ['<%= am.assets %>/src/**/*.less'],
    tasks: ['newer:less:all', 'newer:autoprefixer:dist']
  },
}

Finally, as watch is waiting for changes, I tested by editing the file home.less, and got the output in my terminal as follows:

Running "watch" task
Waiting...OK
>> File "..\assets\src\corp\less\home.less" changed.

Running "newer:less:all" (newer) task
No newer files to process.
jdhorner commented 10 years ago

I just now realized this, I suppose, is basically the same as #29.

tschaub commented 10 years ago

Yeah, since home.less is not one of your src files, the newer task doesn't know anything about it (the watch task doesn't pass along any information to other tasks, it just triggers them).

I'll report back on #29 and #18 when there is a general solution.

tschaub commented 10 years ago

See #35 for a proposed general solution and #29 for any discussion specific to LESS.