-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (43 loc) · 1.16 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
'use strict';
const { series, parallel, watch } = require('gulp');
const requireDir = require('require-dir');
const browserSync = require('browser-sync').create();
const tasks = requireDir('./gulp/tasks', { recurse: true });
const paths = require('./gulp/paths');
const serve = () => {
return browserSync.init({
server: 'build',
notify: false,
open: false,
cors: true,
ui: false,
logPrefix: 'DevServer',
host: 'localhost',
port: process.env.PORT || 1234,
});
};
const watcher = done => {
watch(paths.watch.html).on(
'change',
series(tasks.html, tasks.inject, browserSync.reload),
);
watch(paths.watch.css).on('change', series(tasks.css, browserSync.reload));
watch(paths.watch.js).on('change', series(tasks.scripts, browserSync.reload));
watch(paths.watch.images, tasks.images);
watch(paths.watch.fonts, tasks.fonts);
done();
};
exports.start = series(
tasks.clean,
tasks.images,
parallel(tasks.css, tasks.fonts, tasks.scripts, tasks.html),
tasks.inject,
watcher,
serve,
);
exports.build = series(
tasks.clean,
tasks.images,
parallel(tasks.css, tasks.fonts, tasks.scripts, tasks.html),
tasks.inject,
);