-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserve.js
executable file
·68 lines (56 loc) · 1.36 KB
/
serve.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
/* eslint-disable import/no-extraneous-dependencies */
const { series, watch } = require('gulp');
const browserSync = require('browser-sync').create();
const config = require('./config');
const { scss } = require('./scss');
const { twig } = require('./twig');
const { javascript } = require('./javascript');
const { img } = require('./img');
const { fonts } = require('./fonts');
const { video } = require('./video');
const serve = cb => {
browserSync.init({
server: config.output,
startPath: 'index.html',
open: false,
port: 8081
});
watch(config.pages.watch).on(
'change',
series(twig, browserSync.reload)
);
watch(config.styles.watch).on(
'change',
series(scss, browserSync.reload)
);
watch(config.scripts.watch).on(
'change',
series(javascript, browserSync.reload)
);
watch(config.img.input).on(
'change',
series(img, browserSync.reload)
);
watch(config.img.input).on(
'add',
series(img, browserSync.reload)
);
watch(config.video.input).on(
'change',
series(video, browserSync.reload)
);
watch(config.video.input).on(
'add',
series(video, browserSync.reload)
);
watch(config.fonts.input).on(
'change',
series(fonts, browserSync.reload)
);
watch(config.fonts.input).on(
'add',
series(fonts, browserSync.reload)
);
cb();
};
exports.serve = serve;