-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.ts
61 lines (53 loc) · 1.41 KB
/
gulpfile.ts
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
import * as gulp from 'gulp'
import * as sass from 'gulp-sass'
import * as rename from 'gulp-rename'
import * as autoprefixer from "autoprefixer"
import * as gzip from "gulp-gzip"
const cssnano = require('cssnano');
const postcss = require('gulp-postcss');
const postcssflexbugsfixes = require('postcss-flexbugs-fixes');
gulp.task('sass', () => {
var plugins = [
autoprefixer({
browsers: [
'Chrome >= 35',
'Firefox >= 38',
'Edge >= 12',
'Explorer >= 10',
'iOS >= 8',
'Safari >= 8',
'Android 2.3',
'Android >= 4',
'Opera >= 12'
]
}),
postcssflexbugsfixes()
];
return gulp.src('./scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss(plugins))
.pipe(gulp.dest('./dist/css'));
})
gulp.task('cssnano',['sass'], () => {
var plugins = [
cssnano()
];
return gulp.src('./dist/css/**/*[!(.min)].css')
.pipe(postcss(plugins))
.pipe(rename(function (path) {
path.basename += ".min";
}))
.pipe(gulp.dest('./dist/css'));
})
gulp.task('gzip',['cssnano'], () => {
return gulp.src('./dist/css/**/*.min.css')
.pipe(gzip())
.pipe(gulp.dest('./dist/css'));
})
gulp.task('build', ['gzip'], () => {
})
gulp.task('watch', () => {
gulp.watch('./scss/**/*.scss', ['gzip']);
})
gulp.task('dev',['build','watch'],()=>{
})