在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mariusGundersen/gulp-flatMap开源软件地址(OpenSource Url):https://github.com/mariusGundersen/gulp-flatMap开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-flatmap
Install$ npm install --save-dev gulp-flatmap Usagevar gulp = require('gulp');
var flatmap = require('gulp-flatmap');
var uglify = require('gulp-uglify');
var path = require('path');
var concat = require('gulp-concat');
gulp.task('default', function () {
return gulp.src('*.json')
.pipe(flatmap(function(stream, file){
var contents = JSON.parse(file.contents.toString('utf8'));
//contents.files is an array
return gulp.src(contents.files)
//uglify each file individually
.pipe(uglify())
//combine the files
.pipe(concat(path.basename(file.path)));
}))
.pipe(gulp.dest('dist'));
}); APIThe flatmap method takes one argument, a function. This function is called once for each file piped to You can now pipe this stream through as many steps as you want, before returning it from the function. All the streams returned from LicenseMIT © Marius Gundersen |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论