-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
42 lines (36 loc) · 1.11 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
const { series, src, dest, watch } = require('gulp');
const imagemin = require('gulp-imagemin');
const svgSprite = require('gulp-svg-sprite');
const colorGroups = require('color-groups');
const config = require('./config');
const svgConfig = {
mode: {
symbol: {
inline: true,
dest: '',
sprite: 'sprite.svg',
},
},
};
function fonts() {
return src('**/*', { cwd: `${config.path.assets}/fonts` }).pipe(dest(`${config.path.dist}/fonts`));
}
function icons() {
return src('**/*.svg', { cwd: `${config.path.assets}/icons` })
.pipe(svgSprite(svgConfig))
.pipe(dest(`${config.path.dist}/icons`));
}
function images() {
return src(`${config.path.assets}/images/**`)
.pipe(imagemin())
.pipe(dest(`${config.path.dist}/images`));
}
exports.fonts = fonts;
exports.icons = icons;
exports.images = images;
exports.watch = function() {
watch(`${config.path.assets}/fonts/**`, fonts);
watch(`${config.path.assets}/icons/**`, icons);
watch(`${config.path.assets}/images/**`, images);
};
exports.default = series(fonts, icons, images);