-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgulpfile.js
39 lines (31 loc) · 931 Bytes
/
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
const { src, dest, series, watch } = require('gulp');
const concat = require('gulp-concat');
const inlineSource = require('gulp-inline-source');
const fileInclude = require('gulp-file-include');
function html() {
return src('src/*.html')
.pipe(fileInclude({ prefix: '@@', basepath: '@file' }))
.pipe(inlineSource())
.pipe(dest('dist'));
}
function css() {
return src('src/css/*.css')
.pipe(concat('styles.css'))
.pipe(dest('src'));
}
function js() {
return src('src/js/*.js')
.pipe(concat('scripts.js'))
.pipe(dest('src'));
}
function watchFiles() {
watch('src/*.html', series(html));
watch('src/partials/*.html', series(html));
watch('src/css/*.css', series(css));
watch('src/js/*.js', series(js));
}
async function build() {
return series(html, css, js);
}
exports.default = series(html, css, js, watchFiles);
exports.build = build;