forked from IOriens/ioriens.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
54 lines (45 loc) · 1.13 KB
/
gulpfile.js
File metadata and controls
54 lines (45 loc) · 1.13 KB
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
const gulp = require('gulp')
const htmlmin = require('gulp-htmlmin')
const browserSync = require('browser-sync').create()
const jsonminify = require('gulp-jsonminify')
const img64Html = require('gulp-img64-html')
function html() {
return gulp
.src('src/index.html')
.pipe(
img64Html({
ignoreExternal: true // will skip http & https
})
)
.pipe(
htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: { compress: true }
})
)
.pipe(gulp.dest('.', { overwrite: true }))
.pipe(browserSync.stream())
}
function json() {
return gulp
.src('./src/*.json')
.pipe(jsonminify())
.pipe(gulp.dest('.'))
.pipe(browserSync.stream())
}
function assets() {
return gulp.src('./src/assets/**').pipe(gulp.dest('assets'))
}
exports.html = html
exports.json = json
exports.assets = assets
exports.dev = gulp.series(html, json, assets, function () {
browserSync.init({
server: './'
})
gulp.watch('src/*.html', html)
gulp.watch('src/*.json', json)
})
exports.default = exports.build = gulp.parallel(html, json, assets)