-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
61 lines (53 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
61
import gulp from 'gulp';
import browserSync from 'browser-sync';
import { isProd, path } from './config.js';
import del from './task/del.js';
import font from './task/font.js';
import img from './task/img.js';
import js from './task/js.js';
import publicFiles from './task/public-files.js';
import sass from './task/sass.js';
import server from './task/server.js';
import twig from './task/twig.js';
function watch() {
gulp.watch(path.font.watch, font).on('change', browserSync.reload);
gulp.watch(path.img.watch, img).on('change', browserSync.reload);
gulp.watch(path.js.watch, js).on('change', browserSync.reload);
gulp.watch(path.public.watch, publicFiles).on('change', browserSync.reload);
gulp.watch(path.sass.watch, sass);
gulp.watch(path.twig.watch, twig).on('change', browserSync.reload);
}
function compileFiles() {
return gulp.series(
del,
gulp.parallel(font, img, js, publicFiles, sass, twig),
);
}
function startServer() {
return gulp.parallel(server, watch);
}
function startDevServer() {
return gulp.series(
compileFiles(),
startServer(),
);
}
const dev = startDevServer();
const prod = compileFiles();
const build = compileFiles();
const preview = startServer();
export {
del,
font,
img,
js,
publicFiles,
sass,
server,
twig,
dev,
prod,
build,
preview,
};
export default isProd ? prod : dev;