在较旧的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 07001. Plugin authors are encouraged to upgrade their plugins.