forked from wangweianger/web-report-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
50 lines (38 loc) · 1.04 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
42
43
44
45
const gulp = require('gulp')
const connect = require('gulp-connect')
const babel = require('gulp-babel')
const uglify = require('gulp-uglify')
const clean = require('gulp-clean')
const rename = require("gulp-rename");
const stripDebug = require('gulp-strip-debug');
gulp.task('connect', function() {
connect.server({
root: './',
port: 8080,
livereload: true
});
});
gulp.task('html', function () {
gulp.src('./test/*.html')
.pipe(connect.reload());
});
gulp.task('babel', () =>
gulp.src('./src/*.js')
.pipe(babel({
presets: ['env']
}))
.pipe(gulp.dest('./dist'))
);
gulp.task('watch', function () {
gulp.watch(['./app/*.html'], ['html']);
gulp.watch(['./src/*.js'], ['babel']);
gulp.watch(['./src/*.js'], ['html']);
});
gulp.task('default', ['connect', 'watch','babel']);
gulp.task('build', () =>
gulp.src('./dist/performance-report.js')
.pipe(stripDebug())
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist'))
);