-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
97 lines (83 loc) · 1.87 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var gulp = require('gulp'),
path = require('path'),
packageJSON = require('./package.json'),
sassGlob = require('gulp-sass-glob'),
sass = require('gulp-sass')(require('node-sass'));
postcss = require('gulp-postcss'),
cssnano = require('gulp-cssnano'),
svgSprite = require('gulp-svg-sprite');
var source = {
icon: 'src/icons/*',
logo: 'src/logos/*'
};
var watch = {
sass: 'src/css/**',
icon: 'src/icons/*',
logo: 'src/logos/*'
};
// Process, lint, and minify Sass files
gulp.task('sass', function () {
return gulp.src(packageJSON.css)
.pipe(sassGlob())
.pipe(sass().on('error', sass.logError))
.pipe(postcss([
require('postcss-pxtorem')({
propList: [
'font-size',
'letter-spacing'
],
replace: false
}),
require('autoprefixer')()
]))
.pipe(cssnano({
reduceIdents: {
counter: false,
keyframes: false,
}
}))
.pipe(gulp.dest('./'))
});
gulp.task('s-icon', function() {
return gulp.src(source.icon)
.pipe(svgSprite({
svg: {
xmlDeclaration: false,
doctypeDeclaration: false,
namespaceIDs: false,
dimensionAttributes: true
},
mode: {
inline: true,
symbol: {
dest: 'i',
sprite: 'icons.svg',
}
}
}))
.pipe(gulp.dest('.'));
});
gulp.task('s-logo', function() {
return gulp.src(source.logo)
.pipe(svgSprite({
svg: {
xmlDeclaration: false,
doctypeDeclaration: false,
namespaceIDs: false,
dimensionAttributes: true
},
mode: {
inline: true,
symbol: {
dest: 'i',
sprite: 'logos.svg',
}
}
}))
.pipe(gulp.dest('.'));
});
gulp.task('watch', function() {
gulp.watch(watch.sass, gulp.series('sass'));
gulp.watch(watch.icon, gulp.series('s-icon'));
gulp.watch(watch.logo, gulp.series('s-logo'));
});