-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
62 lines (54 loc) · 1.39 KB
/
Copy pathgulpfile.js
File metadata and controls
62 lines (54 loc) · 1.39 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
54
55
56
57
58
59
60
61
62
const { src, dest, series, parallel } = require('gulp');
const minify = require('gulp-minify');
const concat = require('gulp-concat');
const cleanCss = require('gulp-clean-css');
const htmlReplace = require('gulp-html-replace');
const del = require('del');
function cleanPublicFolder() {
return del(['public/*']);
}
function minifyJs() {
return src(['js/jquery.maskedinput.min', 'js/script.js'], { allowEmpty: true })
.pipe(minify({noSource: true}))
.pipe(dest('public/js'))
}
function minifyCss() {
return src(['css/framework.css', 'css/style.css', 'css/custom.css', 'css/404.css'], {allowEmpty: true })
.pipe(concat('stylesheet.css'))
.pipe(cleanCss())
.pipe(dest('public/css'))
}
function copyAssets() {
return src('assets/*')
.pipe(dest('public/assets'));
}
function copyHtml() {
return src('*.html')
.pipe(dest('public'));
}
function replaceIndexRef() {
return src('index.html')
.pipe(htmlReplace({
'css': 'css/stylesheet.css',
'js': 'js/script-min.js'
}))
.pipe(dest('public'));
}
function replaceRef404() {
return src('404-page.html')
.pipe(htmlReplace({
'css': 'css/stylesheet.css',
}))
.pipe(dest('public'));
}
exports.default = series(
cleanPublicFolder,
parallel(
copyAssets,
minifyCss,
minifyJs,
copyHtml
),
replaceIndexRef,
replaceRef404
)