-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
52 lines (48 loc) · 1.32 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
var gulp = require('gulp');
var watch = require('gulp-watch');
var less = require('gulp-less');
var path = require('path');
var svgSprite = require('gulp-svg-sprite');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
gulp.task('default', function() {
return gulp.src('./less/main.less')
.pipe(watch('/less/**/*.less'))
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(gulp.dest('./css'));
});
gulp.task ('svg', function () {
gulp.src('./img/icons/**/*.svg')
.pipe(svgSprite({
svg: {
namespaceClassnames: false
},
mode: {
symbol: {
sprite: 'svg/sprite.svg'
}
}
})).pipe(gulp.dest('./img/sprites'));
});
// gulp.task('less', function () {
// return gulp.src('./less/main.less')
// .pipe(less({
// paths: [ path.join(__dirname, 'less', 'includes') ]
// }))
// .pipe(gulp.dest('./css'));
// });
gulp.task('css', function () {
var processors = [
autoprefixer({browsers: ['last 2 version']}),
cssnano(),
];
return gulp.src('./less/main.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(postcss(processors))
.pipe(gulp.dest('./css'));
});