如何在编写grunt模块时公开依赖项

时间:2016-05-27 02:06:13

标签: javascript node.js gruntjs

我正在构建一个使用grunt-foo的模块grunt-galvanize(例如,我的package.json中的模块作为依赖项)。像这样:

module.exports = function(grunt) {
  require('load-grunt-tasks')(grunt)

  grunt.registerMultiTask('foo', 'do your foo', function() {
    grunt.task.run('bar');
  });

  grunt.registerTask('bar', function() {
     // Add some galvanize configs
     grunt.option('galvanizeConfig', { configs: { ... } });
     grunt.task.run(['galvanize:baz'])
  });

  grunt.registerTask('baz', function() { grunt.log.ok('baz'); });
};

但是,当我在应用中使用此grunt模块并运行grunt foo时,我会得到类似Warning: Task "galvanize:baz" not found. Use --force to continue.

的内容

我正在寻找一种解决方案,不需要在使用我的grunt模块的应用程序中安装grunt-galvanize作为依赖项(dev或其他)。

0 个答案:

没有答案