-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (63 loc) · 1.91 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const { src, dest, series, watch, parallel } = require('gulp')
const pug = require('gulp-pug')
const sass = require('gulp-sass')
const replace = require('gulp-replace')
const minifyCSS = require('gulp-csso')
const del = require('del')
function clean() {
return del(['public/build', 'build'])
}
function cleanMobile() {
return del(['public/build'])
}
function mobilestatic() {
src('src/config.xml').pipe(dest('build'))
// src('src/js').pipe(dest('build'))
return src('public/**/*')
.pipe(replace(/url\(\/fonts/g, 'url(../../fonts'))
.pipe(replace(/href = '\//g, "href = 'file:///android_asset/www/"))
.pipe(dest('build/www/'))
}
function mobilehtml() {
return src('views/*.pug')
.pipe(
pug({
pretty: true
})
)
.pipe(replace(/action="\//g, 'action="https://root-maintenance-manager.herokuapp.com/'))
.pipe(replace(/href="\/"/g, 'href="/index.html"'))
.pipe(replace(/href="\/calibration"/g, 'href="/calibration.html"'))
.pipe(replace(/href="\/spares"/g, 'href="/spares.html"'))
.pipe(replace(/href="\/about"/g, 'href="/about.html"'))
.pipe(replace(/href="\/users"/g, 'href="/users.html"'))
.pipe(replace(/href="\/login"/g, 'href="/login.html"'))
.pipe(replace(/href="\/register"/g, 'href="/register.html"'))
.pipe(replace(/"\//g, '"'))
.pipe(dest('build/www'))
}
function mobilecss() {
return src('src/scss/*.scss')
.pipe(sass())
.pipe(minifyCSS())
.pipe(dest('build/www/css'))
}
// function devhtml() {
// watch('views', parallel(html))
// }
function css() {
return src('src/scss/*.scss')
.pipe(sass())
.pipe(minifyCSS())
.pipe(dest('public/build/css'))
}
function dev() {
watch('src/scss', parallel(css))
}
exports.clean = clean
exports.mobile = series(cleanMobile, parallel(mobilecss, mobilehtml, mobilestatic))
// exports.devhtml = devhtml
// exports.default = series(clean, html)
exports.devCss = parallel(css)
exports.default = series(clean)
// exports.default = parallel(dev)