forked from DanWahlin/ES2015Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (31 loc) · 961 Bytes
/
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'),
es6Path = 'samples/*.js',
compilePath = 'samples/js',
dist = 'samples/js';
gulp.task('compressScripts', function () {
gulp.src([
compilePath + '/*.js'
])
.pipe(plumber())
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest(dist));
});
gulp.task('babel', function () {
gulp.src([es6Path])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(compilePath));
});
gulp.task('watch', function() {
gulp.watch([es6Path], ['babel']);
});
gulp.task('default', ['babel', 'watch', 'compressScripts']);