-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (44 loc) · 1.08 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
"use strict";
const fs = require("fs");
const autoprefixer = require("gulp-autoprefixer");
const cleanCSS = require("gulp-clean-css");
const gulp = require("gulp");
const header = require("gulp-header");
const rename = require("gulp-rename");
const replace = require("gulp-replace");
const uglify = require("gulp-terser");
const css = () =>
gulp
.src("./slp.css")
.pipe(
autoprefixer({
cascade: false,
})
)
.pipe(cleanCSS())
.pipe(
rename({
suffix: ".min",
})
)
.pipe(gulp.dest((file) => file.base));
const js = () =>
gulp
.src("./SLPTheme.js")
.pipe(
replace(/{{ aviReplace (.+?) }}/gs, (_, $1) =>
fs.readFileSync($1).toString()
)
)
.pipe(uglify())
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest((file) => file.base));
const bookmark = () =>
gulp
.src("./SLPTheme.min.js")
.pipe(header("javascript:"))
.pipe(rename("bookmark.txt"))
.pipe(gulp.dest((file) => file.base));
const build = gulp.series(css, js, bookmark);
exports.build = build;
exports.default = build;