javascript - How to load a task using loadNpmTask in gruntfile if module is in different directory -


trying load module: grunt.loadnpmtasks('grunt-express-server'); external directory.

get error: task .... not exist. have loaded it?

directory structure:

client/   node_modules   gruntfile dev_server/   node_modules/     grunt-express-server 

so question is: how run grunt-task using node-module stored in external directory?

you need use grunt.task.loadtasks pointing task directory want load tasks.

in case:

grunt.loadtasks('../dev_server/node_modules/grunt-express-server/tasks'); 

if check grunt's master on github, @ line 325 of task.js requires taskfile (.../tasks/express.js) located in filepath passed parameter.

// load taskfile. fn = require(path.resolve(filepath)) 

edit

if you're wondering if can relocate grunt's path node_modules, check out question


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -