-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (72 loc) · 1.84 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
73
74
75
76
77
78
79
80
81
82
83
const { src, dest, watch, parallel, series } = require('gulp');
const minHtml = require('gulp-htmlmin');
const minJs = require('gulp-uglify');
const minCss = require('gulp-clean-css');
const concat = require('gulp-concat');
const clean = require('gulp-clean');
const dist = {
folder: './build',
css: './build/css',
images: './build/images',
js: './build/js',
lib: './build/lib',
font: './build/fonts'
};
function fonts(cb) {
src('src/fonts/**')
.pipe(dest(dist.font));
cb();
}
function images(cb) {
src('src/images/**')
.pipe(dest(dist.images));
cb();
}
function minifyHtml(cb) {
src('src/*.html')
.pipe(minHtml({
collapseWhitespace: true,
removeComments: true
}))
.pipe(dest(dist.folder));
cb();
}
function minifyJs(cb) {
src('src/js/*.js')
// .pipe(concat("script.js"))
.pipe(minJs())
.pipe(dest(dist.js));
cb();
}
function minifyCss(cb) {
src('src/css/*.css')
//.pipe(concat("styles.css"))
.pipe(minCss())
.pipe(dest(dist.css));
cb();
}
function clear(cb) {
src(dist.folder)
.pipe(clean({force: true}));
cb();
}
function build(cb) {
parallel();
cb();
}
function watchModifiedFiles() {
watch('src/**/*.html', minifyHtml);
watch('src/**/*.js', minifyJs);
watch('src/**/*.css', minifyCss);
}
exports.minifyHtml = minifyHtml;
exports.compressJs = minifyJs;
exports.minifyCss = minifyCss;
exports.fonts = fonts;
exports.images = images;
exports.clear = clear;
exports.build = build;
exports.watchModifiedFiles = watchModifiedFiles;
exports.default = series(minifyHtml, minifyJs, minifyCss, fonts, images);
// sudo rsync -avz ./build [email protected]:/home/andreamenezes/www
//scp -r ./build/ [email protected]:/home/andreamenezes/www/