I'd like to use the grunt-contrib-watch plugin as well as others in one of my own Node.js projects. The only problem is I can't figure out how to interact with them programmatically. Here's an example:
grunt.config.init({
jshint: {
all: ['asourcefile.js']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.task.run('jshint');
Grunt loads the jshint
plugin ok and it seems like it can find my task (using a made up name throws an error), it just doesn't seem to actually execute it.
Where am I going wrong and is this even the best way to interact with a grunt plugin programmatically?
A lot of gruntplugins are just wrappers around existing Node.js libraries. JSHint's, for example . If you're writing a Node.js app, don't use the grunt wrappers:
var jshint = require('jshint');
// ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.