-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (66 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
71
const { src, dest } = require("gulp");
const postcss = require("gulp-postcss");
const postcssEasyImport = require("postcss-easy-import");
const postcssPresetEnv = require("postcss-preset-env");
const rename = require("gulp-rename");
const cssnano = require("cssnano");
const discardComments = require("postcss-discard-comments");
const beautify = require("gulp-jsbeautifier");
const minify = require("gulp-minify");
const zip = require("gulp-zip");
function styles(cb) {
const postcssPlugins = [
postcssEasyImport(),
postcssPresetEnv({
stage: 3,
features: {
"nesting-rules": true,
},
browsers: "last 2 versions",
}),
];
return src("src/styles/**/*.css")
.pipe(postcss(postcssPlugins))
.pipe(beautify())
.pipe(dest("assets/css"))
.pipe(rename({ suffix: ".min" }))
.pipe(postcss([cssnano(), discardComments()]))
.pipe(dest("assets/css"));
}
function scripts() {
return src("src/scripts/**/*.js")
.pipe(beautify())
.pipe(dest("assets/js"))
.pipe(
minify({
ext: {
min: ".min.js",
},
})
)
.pipe(dest("assets/js"));
}
function compress() {
return src([
"./**",
"!src",
"!src/**",
"!_dist",
"!_dist/**",
"!node_module/",
"!node_modules/**",
"!gulpfile.js",
"!*.dist",
"!*.log",
"!*.DS_Store",
"!*.gitignore",
"!*.git",
"!*.json",
"!phpcs.xml",
])
.pipe(zip("welcomewp.zip"))
.pipe(dest("./_dist"));
}
exports.styles = styles;
exports.scripts = scripts;
exports.compress = compress;