-
Notifications
You must be signed in to change notification settings - Fork 65
/
gulpfile.js
70 lines (61 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
68
69
70
import gulp from "gulp";
import babel from "gulp-babel";
import minifycss from "gulp-clean-css";
import uglify from "gulp-uglify";
import rename from "gulp-rename";
import concat from "gulp-concat";
process.on('unhandledRejection', error => {
console.error('unhandledRejection', error);
process.exit(1);
});
const CleanCssOps = {
level: {
1: {
specialComments: 0
},
2: {
all: true
}
}
}
const cssLib = ["./source/css/fonts/FontModule.css"];
gulp.task('build-theme-minifyCss', async function () {
await gulp
.src(cssLib.concat('./source/css/JSimple.css'))
.pipe(minifycss(CleanCssOps))
.pipe(concat("./source/css/JSimple.min.css"))
.pipe(gulp.dest('./'));
});
gulp.task("build-highlight-minifyCss", async function () {
await gulp
.src("./source/css/highlight/*.css")
.pipe(minifycss(CleanCssOps))
.pipe(rename({ extname: ".min.css" }))
.pipe(gulp.dest("./source/css"));
});
const jsLib = ["./source/js/lib/zepto.min.js"];
gulp.task('build-minifyJs', async function () {
await gulp
.src(jsLib.concat('./source/js/lib/SimpleCore.js'))
.pipe(
babel({
ignore: jsLib,
presets: ['@babel/preset-env']
})
)
.pipe(uglify())
.pipe(concat('./source/js/SimpleCore.min.js'))
.pipe(gulp.dest('./'));
});
gulp.task(
"build-minifyCss",
gulp.parallel("build-theme-minifyCss", "build-highlight-minifyCss", function (done) {
done();
})
);
gulp.task(
'default',
gulp.parallel('build-minifyCss', 'build-minifyJs', function (done) {
done();
})
);