我正在与magento2-frontools合作,并尝试解决此问题:
https://github.com/SnowdogApps/magento2-frontools/issues/231
问题是,如果出现错误,gulp styles
应该具有非零的退出代码,但是它会以0
退出。
gulp文件如下所示:
// Tasks loading
require('gulp-task-loader')({
dir : 'task',
plugins: plugins,
configs: config
});
而styles.js任务是这样的:
'use strict';
module.exports = function() { // eslint-disable-line func-names
// Global variables
const gulp = this.gulp,
plugins = this.opts.plugins,
config = this.opts.configs,
themes = plugins.getThemes(),
streams = plugins.mergeStream();
// Generate all necessary symlinks before styles compilation, but ony if not a part of tasks pipeline
if (!plugins.util.env.pipeline) {
plugins.runSequence('inheritance');
}
// Loop through themes to compile scss or less depending on your config.json
themes.forEach(name => {
streams.add(require('../helper/scss')(gulp, plugins, config, name));
});
return streams;
};
(都可以是found on GitHub)
如果看过this approach来解决问题:
.once("error", function () {
this.once("finish", () => process.exit(1));
})
但是我可以在哪里添加该代码?
最佳答案
仅需使用--ci
标志。
关于error-handling - gulp-tasks加载的任务失败后,错误退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45006766/