javascript - Grunt task dependencies -
i have grunt task installed via npm taska
(not actual name)
taska has dependency: grunt-contrib-stylus , specified in taska's package.json , installed. reason when running grunt default main gruntfile.js gives error.
warning: task "stylus" not found. use --force continue.
and fix require grunt-contrib-stylus in main project. want avoid this. reason task not using grunt-contrib-stylus in node_modules/ ?
taska
module.exports = function(grunt) { 'use strict'; grunt.loadnpmtasks('grunt-contrib-stylus'); ...
main gruntfile.js
... grunt.loadnpmtasks('taska'); ...
grunt.loadnpmtasks
loads [cwd]/node_modules/[modulename]/tasks/
. can load task dependenies changing cwd
:
taska
module.exports = function(grunt) { var parentcwd = process.cwd(); process.chdir(__dirname); grunt.loadnpmtasks('grunt-contrib-stylus'); process.chdir(parentcwd); };
just sure set cwd
parent @ end.
Comments
Post a Comment