在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):gulp-community/gulp-concat开源软件地址(OpenSource Url):https://github.com/gulp-community/gulp-concat开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):InstallationInstall package with NPM and add it to your development dependencies:
Information
Usagevar concat = require('gulp-concat');
gulp.task('scripts', function() {
return gulp.src('./lib/*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('./dist/'));
}); This will concat files by your operating system's newLine. It will take the base directory from the first file that passes through it. Files will be concatenated in the order that they are specified in the var concat = require('gulp-concat');
gulp.task('scripts', function() {
return gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js'])
.pipe(concat('all.js'))
.pipe(gulp.dest('./dist/'));
}); To change the newLine simply pass an object as the second argument to concat with newLine being whatever ( For instance: .pipe(concat('main.js', {newLine: ';'})) To specify var concat = require('gulp-concat');
gulp.task('scripts', function() {
return gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js'])
.pipe(concat({ path: 'new.js', stat: { mode: 0666 }}))
.pipe(gulp.dest('./dist'));
}); This will concat files into Source mapsSource maps can be generated by using gulp-sourcemaps: var gulp = require('gulp');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('javascript', function() {
return gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('all.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
}); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论