-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
44 lines (38 loc) · 917 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
39
40
41
42
43
44
const gulp = require('gulp');
const del = require('del');
const prettyData = require('gulp-pretty-data');
const autoprefixer = require('gulp-autoprefixer');
const destDir = './build';
const sourceDir = './dist';
function cleanDist(done) {
del([destDir]).then(() => done());
}
gulp.task('clean', cleanDist);
gulp.task('cssfixer', ['clean'], () =>
gulp
.src(`${sourceDir}/**/*.wxss`)
.pipe(
autoprefixer({
browsers: ['last 11 iOS versions'],
cascade: false
})
)
.pipe(gulp.dest(sourceDir))
);
gulp.task('minify', ['cssfixer'], () => {
gulp
.src(`${sourceDir}/**/*.{wxml,json,wxss,svg,js}`)
.pipe(
prettyData({
type: 'minify',
preserveComments: true,
extensions: {
wxss: 'css',
wxml: 'xml',
svg: 'xml'
}
})
)
.pipe(gulp.dest(destDir));
});
gulp.task('default', ['minify']);