-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
51 lines (44 loc) · 1.31 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
/* eslint-disable */
const path = require('path')
const gulp = require('gulp')
const babel = require('gulp-babel')
const postcss = require('gulp-postcss')
const del = require('del')
const concat = require('gulp-concat')
const sourcemaps = require('gulp-sourcemaps')
const postCssPlugins = [
require('postcss-import')({
root: __dirname,
path: [path.join(__dirname, './src')],
}),
require('postcss-mixins')(),
require('postcss-each')(),
require('postcss-apply')(),
require('postcss-nesting')(),
require('postcss-reporter')({ clearMessages: true }),
]
// 合并所有css
gulp.task('lib-css', function() {
return gulp
.src(['./src/*.css', './src/**/*.css'])
.pipe(sourcemaps.init())
.pipe(postcss(postCssPlugins))
.pipe(concat('index.css'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./lib'))
})
gulp.task('tsd', function() {
return gulp.src('./src/**/*.d.ts').pipe(gulp.dest('./lib'))
})
gulp.task('js', function() {
return gulp
.src(['./src/**/*.js', '!./src/**/__test__'])
.pipe(babel())
.pipe(gulp.dest('./lib'))
})
gulp.task('clean-lib', function(done) {
del.sync(['./lib'])
done()
})
gulp.task('lib', gulp.parallel('js', 'lib-css', 'tsd'))
gulp.task('default', gulp.series('clean-lib', 'lib'))