-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.babel.js
63 lines (55 loc) · 1.34 KB
/
gulpfile.babel.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
import browserSync from 'browser-sync';
import gulp from 'gulp';
import a11y from './gulp/a11y';
import clean from './gulp/clean';
import html from './gulp/html';
import images from './gulp/images';
import scripts from './gulp/scripts';
import styles from './gulp/styles';
import injectRefs from './gulp/injectRefs';
import {
distCSS,
distDir,
distImages,
openBrowser,
port,
srcHTMLWatch,
srcImages,
srcJS,
srcSass,
} from './gulp/config';
const server = browserSync.create();
function serve() {
server.init({
notify: false,
open: openBrowser,
port,
server: {
baseDir: distDir,
},
});
}
function reload(done) {
server.reload();
done();
}
function cssInject(done) {
gulp.src(`${distCSS}/*.css`).pipe(server.stream());
done();
}
function imageInject(done) {
gulp.src(`${distImages}/*.*`).pipe(server.stream());
done();
}
function watchFiles() {
gulp.watch(srcSass, gulp.series(styles, cssInject));
gulp.watch(srcImages, gulp.series(images, imageInject));
gulp.watch(srcJS, gulp.series(scripts, reload));
gulp.watch(srcHTMLWatch, gulp.series(html, injectRefs, reload));
}
gulp.task(
'build',
gulp.series(clean, gulp.series(scripts, styles, html, images, injectRefs)),
);
gulp.task('a11y', gulp.series('build', a11y));
gulp.task('default', gulp.series('build', gulp.parallel(serve, watchFiles)));