Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | Email

4.9. 合并文件

Concatenate files using gulp-concat

		
npm install --save-dev gulp-concat		
		
		

gulpfile.js:

		
// including plugins
var gulp = require('gulp');
var concat = require("gulp-concat");
 
// task
gulp.task('concat', function () {
    gulp.src('./javascript/*.js') // path to your files
    .pipe(concat('concat.js'))  // concat and name it "concat.js"
    .pipe(gulp.dest('path/to/destination'));
});
		
		

Run:

		
gulp concat