我在Grunt写了一个简单的任务。 现在,我想将此任务导出到另一个文件,我遇到了问题。 如何找到我的任务文件? 此任务只是从网站搜索字符串并将其放入文件中。 我正在尝试加载它: grunt.loadTasks('grunt-find'); 我在里面有find.js的文件(grunt-find)。 但它不起作用......我可以在其他地方添加find.js吗?
提前致谢。
I wrote simple task in Grunt. Now, I would like to export this task to another file, and I have a problem with it. How can I find file with my task? This task just searches string from website and putting it in the file. I'm trying load it by: grunt.loadTasks('grunt-find'); I have file (grunt-find) with find.js inside. But it doesn’t work... Can I have to add find.js somewhere else?
Thanks in advance.
最满意答案
grunt.loadTask()将加载作为参数提供的目录中的每个JS文件; 所以,基本上,你必须做类似的事情:
grunt.loadTasks("tasks");你可能有一个名为“tasks”的目录:
project root |- tasks |--- file.js |- Gruntfile.jsgrunt.loadTask() will load every JS file in the directory provided as argument; so, basically, you have to do something like:
grunt.loadTasks("tasks");and you may have a directory called "tasks":
project root |- tasks |--- file.js |- Gruntfile.js更多推荐
发布评论