gulp-concat:如何确保最后连接一个文件?
gulp-concat: how to ensure a file is concatenated last?
gulp.task('scripts', function() {
return gulp.src(['!dev/js/vendor-list.js', 'dev/js/**/*.js'])
.pipe(concat('all.min.js'))
.pipe(gulp.dest('public'));
});
以上代码是我使用 gulp-concat
的 gulp 任务的示例。堆中的某个地方是我的 app.js
文件,我想最后将其连接起来。有没有办法不必按顺序列出所有子文件夹?所有其他文件与顺序无关。我的 app.js
是我最后需要连接的唯一一个顺序敏感的。我考虑过在一个任务中执行两个流,然后合并输出,但我希望有一个更简单的解决方案。有什么想法吗?
试试这个(来自 this question):
[
'!dev/js/vendor-list.js', // can probably be included in the statement below.
'/dev/js/!(app)*.js', // all files that end in .js EXCEPT app*.js
'/dev/js/app.js', // this should be concatenated last
]
gulp.task('scripts', function() {
return gulp.src(['!dev/js/vendor-list.js', 'dev/js/**/*.js'])
.pipe(concat('all.min.js'))
.pipe(gulp.dest('public'));
});
以上代码是我使用 gulp-concat
的 gulp 任务的示例。堆中的某个地方是我的 app.js
文件,我想最后将其连接起来。有没有办法不必按顺序列出所有子文件夹?所有其他文件与顺序无关。我的 app.js
是我最后需要连接的唯一一个顺序敏感的。我考虑过在一个任务中执行两个流,然后合并输出,但我希望有一个更简单的解决方案。有什么想法吗?
试试这个(来自 this question):
[
'!dev/js/vendor-list.js', // can probably be included in the statement below.
'/dev/js/!(app)*.js', // all files that end in .js EXCEPT app*.js
'/dev/js/app.js', // this should be concatenated last
]