-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
60 lines (51 loc) · 1.34 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* jshint node: true, undef: true, unused: true, esversion: 6, scripturl:true */
/* globals require, console */
"use strict";
const gulp = require('gulp');
const pump = require('pump');
const connect = require('gulp-connect');
const sourcemaps = require('gulp-sourcemaps');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
gulp.task('startConnect', function() {
connect.server({
root: './',
livereload: true
});
});
gulp.task('javascript:live', function(cb) {
pump([
gulp.src('./source/in-viewport-class.js'),
sourcemaps.init(),
babel({
presets: ['env']
}),
sourcemaps.write('.'),
gulp.dest('./dist/'),
connect.reload()],
cb
);
});
gulp.task('javascript:build', function(cb) {
pump([
gulp.src('./source/in-viewport-class.js'),
rename({suffix: '.min'}),
sourcemaps.init(),
babel({
presets: ['env']
}),
uglify(),
sourcemaps.write('.'),
gulp.dest('./dist/'),
connect.reload()],
cb
);
});
gulp.task('serve', ['live', 'startConnect']);
gulp.task('build', ['javascript:build']);
gulp.task('live', function() {
gulp.watch(
'./source/in-viewport-class.js',
['javascript:live']);
});