【发布时间】:2014-02-17 18:24:46
【问题描述】:
我有一个 grunt 插件,我们称之为 grunt-my-plugin,在插件的 Gruntfile 中我有一个特定的 cssmin 任务需要运行。测试 grunt 插件时一切正常,但是,当我将它安装到另一个项目时,它给了我以下错误:
Warning: Task "cssmin" not found. Use --force to continue.
一开始我只是从插件的任务文件中调用grunt.task.run('cssmin');,但是看到错误后我意识到使用这个插件的Gruntfile需要指向适当的任务配置,所以我补充说:
grunt.task.loadTasks('./Gruntfile.js');
这仍然是我的错误,所以我尝试了:
grunt.task.loadTasks('./node_modules/grunt-my-plugin/Gruntfile.js');
仍然收到错误消息。那么,我该如何解决这个问题?该插件不需要来自使用它的 Gruntfile 的特定配置。 cssmin 任务用于创建 tmp 副本并针对它运行指标。关于如何实现这一目标的任何想法?谢谢!
【问题讨论】:
标签: gruntjs