-
Notifications
You must be signed in to change notification settings - Fork 94
/
gulpfile.js
32 lines (30 loc) · 956 Bytes
/
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
var gulp = require('gulp');
var gzip = require('gulp-gzip');
gulp.task('default', css);
function css(done) {
var postcss = require('gulp-postcss');
var cleanCSS = require('gulp-clean-css');
var cssvariables = require('postcss-css-variables');
return gulp.src('src/*.css')
.pipe(postcss([cssvariables()]))
.pipe(cleanCSS({ level: 2 }))
.pipe(gulp.dest('dist/'))
.pipe(gzip())
.pipe(gulp.dest('dist/'))
done();
}
gulp.task('minify', minify);
function minify(done) {
var postcss = require('gulp-postcss');
var cleanCSS = require('gulp-clean-css');
var cssvariables = require('postcss-css-variables');
return gulp.src('src/*.css')
.pipe(postcss([cssvariables()]))
.pipe(cleanCSS({ level: 2 }))
.pipe(gulp.dest('dist/'))
done();
}
gulp.task('watch', function(){
gulp.series('minify')
gulp.watch("src/*.css").on('change', gulp.series('minify'));
})