I have a build task in grunt, which looks like this:
我在grunt有一个构建任务,它看起来是这样的:
grunt.registerTask("build", ["jshint", "uglify"]);
The problem is that the uglify task runs even if the jshint task fails, how can I make the 'build' task terminate if one of it's sub tasks fails?
问题是,即使jshint任务失败,也会运行uglify任务,如果其中一个子任务失败,如何让“构建”任务终止?
1 个解决方案
#1
3
The default behavior in Grunt is to not run subsequent tasks if one fails. So you must be using the force option somewhere. You are either:
Grunt中的默认行为是,如果一个任务失败,则不运行后续任务。所以你必须在某处使用force选项。你是:
1 - passing --force
on the command line
1 -传递——命令行上的力。
2 - calling grunt.option( 'force', true );
somewhere
2 -调用咕哝。选项(“力”,真正的);的某个地方
3 - have the jshint force option set on your jshint task
在jshint任务中设置jshint force选项。
Note that in the case of calling grunt.option( 'force', true );
, it remains true for the remainder of the batch, not just inside the task where it was set. see this question and this question for details.
请注意,在调用grunt时。选项(“force”,true);它仍然适用于批处理的其余部分,而不仅仅是在该任务的内部。请参见这个问题和这个问题。
#1
3
The default behavior in Grunt is to not run subsequent tasks if one fails. So you must be using the force option somewhere. You are either:
Grunt中的默认行为是,如果一个任务失败,则不运行后续任务。所以你必须在某处使用force选项。你是:
1 - passing --force
on the command line
1 -传递——命令行上的力。
2 - calling grunt.option( 'force', true );
somewhere
2 -调用咕哝。选项(“力”,真正的);的某个地方
3 - have the jshint force option set on your jshint task
在jshint任务中设置jshint force选项。
Note that in the case of calling grunt.option( 'force', true );
, it remains true for the remainder of the batch, not just inside the task where it was set. see this question and this question for details.
请注意,在调用grunt时。选项(“force”,true);它仍然适用于批处理的其余部分,而不仅仅是在该任务的内部。请参见这个问题和这个问题。