forked from victrme/Bonjourr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
67 lines (58 loc) · 1.55 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
const {series, parallel, src, dest, watch, pipe} = require('gulp');
const concat = require('gulp-concat');
const minify = require('gulp-babel-minify');
const htmlmin = require('gulp-htmlmin');
const csso = require('gulp-csso');
const path = {
scss: ["src/styles/scss/_global.scss", "src/styles/scss/_media.scss", "src/styles/scss/_mixins.scss", "src/styles/scss/style.scss"],
css: ["src/styles/style.css", "src/styles/events.css"],
js: ["src/scripts/lang.js", "src/scripts/script.js", "src/scripts/settings.js"]
}
function defaultTask(cb) {
// place code for your default task here
cb();
}
function scssTask(){
return src(path.scss)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write('.'))
.pipe(concat('style.css'))
.pipe(dest("src/styles")
);
}
function cssTask(){
return src(path.css)
.pipe(csso())
.pipe(concat('style.css'))
.pipe(dest("release/src/styles")
);
}
function htmlTask() {
return src(["index.html", "settings.html"])
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true
}))
.pipe(dest('release/'));
}
function jsTask() {
return src(path.js)
.pipe(concat('main.js'))
.pipe(minify({
mangle: {
keepClassName: true
}
}))
.pipe(dest('release/src/scripts')
);
}
function watchTask(){
watch(
path.css,
parallel(scssTask)
);
}
exports.default = series(
parallel(cssTask, jsTask, htmlTask)/*,
watchTask*/);