- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我想创建一个连续运行 3 个 grunt 任务的 grunt 文件,无论它们是失败还是通过。如果其中一个 grunts 任务失败,我想返回最后一个错误代码。
我试过:
grunt.task.run('task1', 'task2', 'task3');
运行时使用--force
选项。
问题在于,当指定 --force
时,无论出现什么错误,它都会返回错误代码 0。
谢谢
最佳答案
使用 grunt.util.spawn
:http://gruntjs.com/api/grunt.util#grunt.util.spawn
grunt.registerTask('serial', function() {
var done = this.async();
var tasks = {'task1': 0, 'task2': 0, 'task3': 0};
grunt.util.async.forEachSeries(Object.keys(tasks), function(task, next) {
grunt.util.spawn({
grunt: true, // use grunt to spawn
args: [task], // spawn this task
opts: { stdio: 'inherit' }, // print to the same stdout
}, function(err, result, code) {
tasks[task] = code;
next();
});
}, function() {
// Do something with tasks now that each
// contains their respective error code
done();
});
});
关于javascript - Gruntfile 从程序中串行获取错误代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16487681/
我的 Gruntfile.js包含 Compass 的任务: grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), // F
我正在构建一个允许在父应用程序生态系统中创建模块化“应用程序”的框架。 父应用程序将在其根目录下有一个 Gruntfile.js,然后在文件夹结构的更深处将有子“应用程序”,我希望允许它们拥有自己的
Gruntfile.js 位于项目根/Gruntfile.js asset_compress.ini 位于项目根/app/Config/asset_compress.ini 测试是使用 Jasmine
我已经下载了 Foundation 5,但在将插件添加到默认配置中时遇到问题。我从控制台的 Angular 理解插件的安装。然而,在包含并注册任务后,我很难正确编码 Gruntfile.js Grun
我的 Gruntfile 中有以下行。 js files: ['/scripts/{,*/}*.coffee'], 有人可以告诉我什么吗{,*/}*意思是?我知道它试图匹配所有 .coffee脚本文件
这应该是一个快速的答案: 给定以下文件夹结构: ├── public │ ├── app | | ├── Folder A | | | ├──something.js
当我在终端上运行 grunt 命令时,concat 任务不会创建 concat/form.js,我需要它来缩小 javascript 代码。 我有下一个目录结构: src/entry/form.jss
我想创建一个连续运行 3 个 grunt 任务的 grunt 文件,无论它们是失败还是通过。如果其中一个 grunts 任务失败,我想返回最后一个错误代码。 我试过: grunt.task.run('
我的 Gruntfile 现在变得非常大,我想将它分成多个文件。我用 Google 搜索并进行了很多试验,但无法让它发挥作用。 我想要这样的东西: Gruntfile.js module.export
问题 :在 Grunt 项目的“配置任务”页面上,为任务指定文件的“文件对象格式”方式有效,而“文件数组格式”和关键的“动态构建文件对象”方式(请参阅“dynamic_mappings”部分)没有。
是否可以在 Gruntfile 中使用智能感知? 因为“grunt”不是全局变量而是 Gruntfile 中的一个参数,VSCode 将假定它只是一个未知的函数参数“any”。 module.expo
是否可以在 Gruntfile 中使用智能感知? 因为“grunt”不是全局变量而是 Gruntfile 中的一个参数,VSCode 将假定它只是一个未知的函数参数“any”。 module.expo
我刚刚创建了 Gruntfile.js,它在运行 grunt -v 时显示以下错误: Reading "Gruntfile.js" Gruntfile...OK Registering Gruntfi
我第一次尝试使用 Grunt 来完成一些任务。在任何任务中我都会遇到此错误: Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpect
我正在创建一个复杂的 Yeoman Generator,我需要读取现有的 gruntfile 并修改它。 任何解析 gruntfile 的 JavaScript 方法就足够了。 任何帮助将不胜感激。
我有一个非常简单的 Jade 模板,只有一个变量。然而,当我生成html文件时,一堆jade javascript被插入并创建了一个runtime.js文件。 这是我的任务: jade: {
我已经关注了这个 link尝试在 ubuntu 服务器上安装 mean.js 堆栈。 关于grunt,在/opt/mean,我已经做了 sudo npm install -g bower grunt-
在 Gruntfile.js 的 initConfig 函数中,我有以下内容: grunt.initConfig({ pkg: grunt.file.readJSON('package.j
我正在使用查找所有单元测试文件的 karma 任务设置 grunt。我需要访问所有 *.js文件和 *.spec.js文件,但我想排除所有 *.e2e.js文件。基于 node glob文档,我希望以
我正在尝试运行以下 grunt 命令 grunt test:e2e但这似乎不起作用,因为我收到了标题中指出的警告。我不想发布整个 gruntfile.js 所以我提供了要点链接。如果有人能指出我正确的
我是一名优秀的程序员,十分优秀!