forked from davcd/jsonresume-theme-actual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (32 loc) · 929 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
39
40
const { src, dest, watch, series } = require('gulp')
const pug = require('gulp-pug')
const sass = require('gulp-sass')(require('sass'))
const bs = require('browser-sync').create()
const fs = require('fs')
const helper = require('./assets/helper.js')
function css () {
return src('./assets/styles.scss')
.pipe(sass())
.pipe(dest('./assets'))
}
function html () {
const resume = JSON.parse(fs.readFileSync('./resume.json', 'utf-8'))
return src('./assets/template.pug')
.pipe(pug({ data: { resume, helper } }))
.pipe(dest('./public'))
}
function serve () {
bs.init({
server: {
baseDir: './public',
index: 'template.html'
},
ui: false,
open: false
})
watch('./assets/**/*.scss', series(css, html))
watch(['./assets/**/*.pug', './resume.json'], html)
bs.watch('./public/*.html').on('change', bs.reload)
}
exports.css = css
exports.default = series(css, html, serve)