-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (63 loc) · 1.68 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
global.destDir = './dist';
global.srcDir = './src';
const
gulp = require('gulp'),
browserSync = require('browser-sync').create()
buildSASS = require('./tasks/build/sass'),
buildJS = require('./tasks/build/js'),
buildHTML = require('./tasks/build/html'),
buildStatic = require('./tasks/build/static'),
exportJS = require('./tasks/export/js'),
exportHTML = require('./tasks/export/html'),
exportStatic = require('./tasks/export/static'),
exportCSS = require('./tasks/export/css')
;
gulp.task('export', function() {
exportJS();
exportHTML();
exportCSS();
exportStatic();
});
gulp.task('export:js', exportJS);
gulp.task('export:html', exportHTML);
gulp.task('export:static', exportStatic);
gulp.task('export:css', exportCSS);
gulp.task('build:sass', buildSASS);
gulp.task('build:js', buildJS);
gulp.task('build:html', buildHTML);
gulp.task('build:static', buildStatic);
gulp.task('build', function() {
buildSASS();
buildJS();
buildHTML();
buildStatic();
});
gulp.task('serve', ['build'], function () {
browserSync.init({
server: {
baseDir: ['./dist/'],
},
notify: false,
ui: false,
open: false,
injectChanges: true,
});
gulp.watch('./src/scss/**/*', ['reload:sass']);
gulp.watch('./src/js/**/*', ['reload:js']);
gulp.watch('./src/html/**/*', ['reload:html']);
});
gulp.task('reload:sass', function () {
buildSASS().on('end', function() {
browserSync.reload();
});
});
gulp.task('reload:js', function () {
buildJS().on('end', function() {
browserSync.reload();
});
});
gulp.task('reload:html', function () {
buildHTML().on('end', function() {
browserSync.reload();
});
});