MLM*_*MLM 10
您可以使用child_process.exec(...)
CLI API从控制台运行两个gulp任务.有Gulp.run
,但该功能已取消,将被删除向前发展.
此代码段将连续运行以下两个gulp文件.
跑步: node run-two-gulp-files.js
./gulpfile.js
依赖于取决于 ./other-thing-with-gulpfile/gulpfile.js
var exec = require('child_process').exec;
// Run the dependency gulp file first
exec('gulp --gulpfile ./other-thing-with-gulpfile/gulpfile.js', function(error, stdout, stderr) {
console.log('other-thing-with-gulpfile/gulpfile.js:');
console.log(stdout);
if(error) {
console.log(error, stderr);
}
else {
// Run the main gulp file after the other one finished
exec('gulp --gulpfile ./gulpfile.js', function(error, stdout, stderr) {
console.log('gulpfile.js:');
console.log(stdout);
if(error) {
console.log(error, stderr);
}
});
}
});
Run Code Online (Sandbox Code Playgroud)
var gulp = require('gulp');
var replace = require('gulp-replace');
gulp.task('file1-txt', function() {
return gulp.src('file1.txt')
.pipe(replace(/foo/g, 'bar'))
.pipe(gulp.dest('dest'));
});
gulp.task('default', ['file1-txt']);
Run Code Online (Sandbox Code Playgroud)
var gulp = require('gulp');
var replace = require('gulp-replace');
gulp.task('file2-txt', function() {
return gulp.src('file2.txt')
.pipe(replace(/baz/g, 'qux'))
.pipe(gulp.dest('../dest'));
});
gulp.task('default', ['file2-txt']);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8656 次 |
最近记录: |