在较旧的 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 版本中执行助手?
最佳答案
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/