-
Notifications
You must be signed in to change notification settings - Fork 139
/
Copy pathgulpfile.js
37 lines (33 loc) · 1.01 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
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
babel = require('gulp-babel'),
ts = require('gulp-typescript'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
es2015Path = 'samples/*.js',
compilePath = 'samples/js',
dist = 'samples/js';
gulp.task('compressScripts', function () {
return gulp.src([
compilePath + '/*.js'
])
.pipe(plumber())
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest(dist));
});
gulp.task('babel', function () {
return gulp.src([es2015Path])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(compilePath));
});
gulp.task('watch', function() {
gulp.watch(es2015Path, gulp.series('babel'));
});
gulp.task('default', gulp.series('babel', 'watch', 'compressScripts'));