-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
41 lines (37 loc) · 1.07 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const gulp = require('gulp');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const rename = require("gulp-rename");
const header = require('gulp-header');
const pkg = require('./package.json');
const banner = [
'/*! <%= pkg.name %> v<%= pkg.version %>',
' (c) <%= new Date().getFullYear() %> <%= pkg.author %>',
' */\n'].join('');
function es5() {
return gulp.src('src/*.js')
.pipe(babel({
presets: ['@babel/preset-env']
}))
.pipe(uglify({
output: {
comments: false,
beautify: true
},
mangle: false,
compress: false
}))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist'))
}
function es5minify() {
return gulp.src('src/*.js')
.pipe(babel({
presets: ['@babel/preset-env']
}))
.pipe(uglify())
.pipe(header(banner, { pkg : pkg } ))
.pipe(rename({suffix: ".min"}))
.pipe(gulp.dest('dist'))
}
exports.default = gulp.parallel(es5, es5minify);