-
Notifications
You must be signed in to change notification settings - Fork 72
/
gulpfile.js
67 lines (55 loc) · 1.59 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
const { series, src, dest } = require('gulp');
// const sass = require('gulp-sass');
const sass = require('gulp-sass')(require('sass'));
const gulpClean = require('gulp-clean');
const gulpMinify = require('gulp-minify');
const cleanCss = require('gulp-clean-css');
const gulpRename = require("gulp-rename");
const distPath = "./dist";
// Clear dist folder
function clean() {
return src(distPath + "/*", {read: false})
.pipe(gulpClean());
}
// Compile scss and copy to dist folder (.css)
function sassCompile() {
return src('src/tuicss.scss')
.pipe(sass())
.pipe(dest(distPath));
}
// Minify css and copy to dist folder (.min.css)
function minifyCss() {
return src(distPath + '/tuicss.css')
.pipe(cleanCss())
.pipe(gulpRename({
suffix: ".min"
}))
.pipe(dest(distPath));
}
// Copy js script to dist folder (.js)
function copyScript() {
return src('src/js/tuicss.js')
.pipe(dest(distPath));
}
// Minify js script and copy to dist folder (.min.js)
function minifyJs() {
return src(distPath + '/tuicss.js')
.pipe(gulpMinify({
ext:{
min:'.min.js'
}
}))
.pipe(dest(distPath));
}
// Copy images to dist folder (/images)
function copyImages() {
return src('src/images/*')
.pipe(dest(distPath + "/images"));
}
// Copy fonts to dist folder (/fonts)
function copyFonts() {
return src('src/fonts/*')
.pipe(dest(distPath + "/fonts"));
}
// Export
exports.default = series(clean, sassCompile, minifyCss, copyScript, minifyJs, copyImages, copyFonts);