gulp配置文件gulpfile.babel.js
'use strict' var gulp = require('gulp'); var watch = require('gulp-watch'); var babel = require('gulp-babel'); let sourcemaps = require('gulp-sourcemaps'); let uglify = require('gulp-uglify'); gulp.task('transform', () => { return gulp.src('server/**/*.js') // 匹配server文件夹下面的所有js文件 .pipe(sourcemaps.init()) // .pipe(babel()) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('dist/server')); // 写入 'dist/server/'文件夹下 }); gulp.task('watch', () => { return gulp.src('server/**/*.js') .pipe(watch('server/**/*.js', { verbose: true })) .pipe(sourcemaps.init()) .pipe(babel()) .pipe(uglify({ mangle: false })) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('dist/server/')); }); // 执行transform任务 gulp.task('default', () => { gulp.start('transform'); });
相关推荐
我有一只小松鼠 2020-02-29
MrLiar 2015-11-09
idnochinese 2019-07-01
星辰的笔记 2020-07-04
zhongweinan 2020-06-10
jiangfulai 2020-04-18
hlihaihong 2020-01-13
kaosini 2020-01-12
kaosini 2020-01-12
FranksTD 2019-12-19
hlihaihong 2019-12-15
hlihaihong 2019-12-14
我有一只小松鼠 2019-12-14
FranksTD 2019-12-13
SeekerTime 2019-11-17
yuetingzhuying 2015-10-17
福叔 2019-09-06
kaosini 2019-09-06
RainyX 2019-07-01