我想使用gulp将一堆js文件按特定顺序拼接起来,其中要保证文件“custom.js”排在最后(尽管也可以是其他任何文件名)。
这是我的gulp任务:
gulp.task('scripts', function() {
return gulp.src(['src/scripts/**/!(custom)*.js','src/scripts/custom.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
//.pipe(gulp.src('src/scripts/**/*.js')) not needed(?)
.pipe(order([
'!(custom)*.js', // all files that end in .js EXCEPT custom*.js
'custom.js'
]))
.pipe(concat('main.js'))
.pipe(gulp.dest('static/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('static/js'))
.pipe(notify({ message: 'Scripts task complete' }));
});
然而,这只是按字母顺序连接文件。除了将custom.js文件重命名为类似zzz-custom.js的名称之外,我可以做些什么来解决这个问题?