node.js - 如何在新的 Grunt 0.4 中编写助手

标签 node.js gruntjs

在较旧的 grund 版本中,我执行如下助手:

module.exports = function (grunt) {
   grunt.registerMultiTask('taskname', "Grunt task example", function () {
      var result = grunt.helper('helpername', options, data);

      ...
   });

   grunt.registerHelper('helpername', function (options, data) {
      return data;
   });
};

我应该如何在新的 Grunt 0.4 版本中执行助手?

最佳答案

来自Upgrading from 0.3 to 0.4

Helpers

Grunt's helper system has been removed in favor of node require. For a concise example on how to share functionality between Grunt plugins, please see grunt-lib-legacyhelpers. Plugin authors are encouraged to upgrade their plugins.

关于node.js - 如何在新的 Grunt 0.4 中编写助手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15105856/

相关文章:

node.js - 为什么 fs.createReadStream ... pipe(res) 锁定读取的文件?

node.js - NodeJS 流响应以防止内存不足错误

javascript - string.replace 不在 grunt 和 grunt-angular-templates 中链接

javascript - 在 Windows 上使用 node.js 参数运行 grunt 任务

javascript - 在 Node 中运行 Grunt 任务

node.js - AWS Lambda 函数子目录中的处理程序未运行

node.js - 从 nodejs 请求到 s3 的流式响应

javascript - 找不到为导入语句抛出的规则 'jsx-a11y/img-has-alt' 的定义

sass - 运行 "sass:dist"(sass) 任务 Errno::ENOENT: 没有这样的文件或目录@rb_sysopen - 未定义

javascript - 如何为每个html制作一个css?