-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgulpfile.js
More file actions
47 lines (39 loc) · 1.17 KB
/
Copy pathgulpfile.js
File metadata and controls
47 lines (39 loc) · 1.17 KB
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
const gulp = require ('gulp');
const uglify = require ('gulp-uglify');
const concat = require ('gulp-concat');
const babel = require ('gulp-babel');
const plumber = require ('gulp-plumber');
const reload = require ('gulp-livereload');
const vendors = require ('./vendors.js');
gulp.task ('html', function () {
gulp.src ('src/*.html')
.pipe (gulp.dest('build'));
});
gulp.task ('custom-css', function () {
gulp.src ('src/*.css')
.pipe (concat('custom.css'))
.pipe (gulp.dest('build'));
});
gulp.task ('custom-js', function () {
gulp.src ('src/*.js')
.pipe (plumber())
.pipe(babel({
presets: ['es2015']
}))
.pipe (uglify())
.pipe (concat('custom.js'))
.pipe (gulp.dest('build'));
});
gulp.task ('vendor', function () {
gulp.src (vendors.js)
.pipe (uglify())
.pipe (concat('vendors.js'))
.pipe (gulp.dest('build'));
});
gulp.task ('build', ['custom-css', 'custom-js', 'html']);
gulp.task ('build-all', ['build', 'vendor']);
gulp.task ('watch', ['build'], function () {
reload.listen();
gulp.watch('build/**/*').on('change', reload.changed);
return gulp.watch('src/**/*', ['build']);
});