Reputation: 13
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?
Upvotes: 1
Views: 271
Reputation: 10146
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');
// ...
Upvotes: 1