I have a node app that includes multiple unpublished modules. My app's package.json
includes a few git dependencies:
"module-a": "git+ssh://[email protected]:me/module-a.git",
"module-b": "git+ssh://[email protected]:me/module-b.git"
and each of those have their own grunt config. Eg in node_modules/module-a/grunt.js
:
module.exports = function(grunt) {
grunt.initConfig({
lint: {
files: ['server/**/*.js', 'test/**/*.js']
},
jshint: {
options: require('./lint-ci')
}
});
grunt.registerTask('default', 'lint');
};
(they also run tests, etc, but I'm keeping it simple here)
Is there a built-in way to do this with grunt? Note that I want to keep the dependent grunt.js files for convenience when I've only changed something within that dependency.
The only solutions I have found are
--config node_modules/module-a/grunt.js
Neither seems ideal. Is there a better way?
You can configure Grunt to run one or more tasks by default by defining a default task. In the following example, running grunt at the command line without specifying a task will run the uglify task.
grunt. util. _ is deprecated and we highly encourage you to npm install lodash and var _ = require('lodash') to use lodash .
When a task is run, Grunt looks for its configuration under a property of the same name. Multi-tasks can have multiple configurations, defined using arbitrarily named "targets." In the example below, the concat task has foo and bar targets, while the uglify task only has a bar target.
grunt-este-watchby Daniel SteigerwaldRun predefined tasks whenever watched file changes.
Just a thought but have you looked at grunt-hub?
https://github.com/shama/grunt-hub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With