-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (39 loc) · 1.33 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
const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const autoprefixer = require('autoprefixer');
const sass = require('gulp-sass')(require('sass'));
const { src, series, parallel, dest, watch } = require('gulp');
const minify = require('gulp-minify');
const runList = [copyIcons, copyLogo, copyFiles, compileJS, compileSass, copyFonts]
function copyIcons() {
return src("src/icon/**", { encoding: false })
.pipe(dest('dist/icon'));
}
function copyFonts() {
return src("src/assets/fonts/**", { encoding: false })
.pipe(dest('dist/assets/fonts'));
}
function copyLogo() {
return src("src/logo/**", { encoding: false })
.pipe(dest('dist/logo'));
}
function copyFiles() {
return src(["src/robots.txt", "src/favicon.ico"], { encoding: false })
.pipe(dest('dist/'));
}
function compileJS() {
return src(['src/assets/js/**'])
.pipe(minify())
.pipe(dest('dist/assets/js'));
}
function compileSass() {
return src('src/assets/css/**')
.pipe(sass.sync().on('error', sass.logError))
.pipe(postcss([autoprefixer(), cssnano()]))
.pipe(dest('dist/assets/css'));
}
function watchTask() {
watch(["src/**"], { interval: 1000 }, parallel(runList));
}
exports.default = series(parallel(runList), watchTask);
exports.build = series(parallel(runList));