-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (47 loc) · 1.17 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
const gulp = require('gulp');
const connect = require('gulp-connect');
const del = require('del');
const concat = require('gulp-concat');
const useref = require('gulp-useref');
const pathTo = {
root: './',
dist: 'dist',
html: 'src/index.html',
css: 'src/*.css',
js: 'src/js/*.js'
}
gulp.task('serve', () => {
connect.server({
port: 3000,
root: pathTo.root,
livereload: true
});
});
gulp.task('html', () => {
gulp.src(pathTo.html)
.pipe(useref())
.pipe(gulp.dest(pathTo.root))
.pipe(connect.reload());
});
gulp.task('css', () => {
gulp.src(pathTo.css)
.pipe(concat('styles.css'))
.pipe(gulp.dest(pathTo.dist))
.pipe(connect.reload());
});
gulp.task('js', () => {
gulp.src(pathTo.js)
.pipe(concat('app.js'))
.pipe(gulp.dest(pathTo.dist))
.pipe(connect.reload());
});
gulp.task('watch', () => {
gulp.watch(pathTo.html, ['html'])
gulp.watch(pathTo.js, ['js']);
gulp.watch(pathTo.css, ['css']);
});
gulp.task('del', () => {
del(['dist', 'index.html']);
});
gulp.task('default', ['serve', 'watch']);
gulp.task('build', ['html', 'css', 'js']);