-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
38 lines (33 loc) · 994 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
33
34
35
36
37
38
var
gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
cssnext = require('gulp-cssnext'),
cssnano = require('gulp-cssnano'),
replace = require('gulp-replace'),
rename = require('gulp-rename'),
concat = require('gulp-concat')
;
gulp.task('css-main', function () {
return gulp.src('css/main.css')
.pipe(cssnext())
.pipe(autoprefixer({ cascade: false, browsers: 'last 3 versions' }))
.pipe(replace(/svg\>/g, 'svg%3E'))
.pipe(replace(/\<svg/g, '%3Csvg'))
.pipe(replace(/\>\</g, '%3E%3C'))
.pipe(replace(/='#/g, "='%23"))
.pipe(gulp.dest('tmp'))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('_includes'))
;
});
gulp.task('build-css', ['css-main'], function () {
return gulp.src('_includes/main.min.css')
.pipe(cssnano())
.pipe(gulp.dest('_includes'))
;
});
gulp.task('build', ['build-css']);
gulp.task('watch', function() {
gulp.watch('css/*.css', ['css-main']);
});
gulp.task('default', ['css-main']);