Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Grunt newer with custom task

I'm trying to use grunt-newer to watch files from a folder and if any is changed, trigger a custom task.

I have something like this in my Gruntfile.js:

grunt.initConfig({
   watch: {
      widgets: {
         files: "/somepath/*.js",
         tasks: ['newer:mycustomtask']
      }
   }
});

grunt.registerTask("mycustomtask", ["description of my task"], function() {
  console.log("me has been triggered");
});

Whenever I run "grunt watch", I have this output:

Running "watch" task
Waiting...
File "/somepath/WidgetA.js" changed.
Running "newer:mycustomtask" (newer) task
Fatal error: The "newer" prefix is not supported for aliases

I googled but didn't found anything about this. Anyone knows how could I implement this? I need to now in my "customtask" which files have been changed

like image 967
Christian Benseler Avatar asked Nov 22 '22 05:11

Christian Benseler


1 Answers

If you reference a task (inside watch or concurrent e.g.) which is either not installed or not configured you get this error output.

This happens often when you copy-paste a watch config from a different project.

like image 123
Hafenkranich Avatar answered Nov 23 '22 19:11

Hafenkranich