forked from ecomfe/san-mui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
86 lines (73 loc) · 2.2 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* @file build
* @author ielgnaw([email protected])
*/
const gulp = require('gulp');
const babel = require('gulp-babel');
const clean = require('gulp-clean');
const babelHelpers = require('gulp-babel-external-helpers');
const sourcemaps = require('gulp-sourcemaps');
const stylus = require('gulp-stylus');
const path = require('path');
gulp.task('babel', () => {
return gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(babelHelpers('babelHelpers.js', 'umd'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('lib'));
});
gulp.task('stylus-compile', () => {
const rider = require('rider');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
return gulp.src('src/index.styl')
.pipe(stylus({
use: function (style) {
// style.include(path.join(__dirname, 'node_modules'));
style.define('url', stylus.stylus.resolver());
style.use(rider());
},
compress: false
}))
.pipe(postcss([autoprefixer({
browsers: [
'iOS >= 7',
'Android >= 4.0',
'ExplorerMobile >= 10',
'ie >= 9'
]
})]))
.pipe(gulp.dest('lib'))
.pipe(gulp.dest('es'));
});
gulp.task('stylus-source', () => {
return gulp.src('src/**/*.styl')
.pipe(gulp.dest('lib'))
.pipe(gulp.dest('es'));
});
gulp.task('font', () => {
return gulp.src('src/**/font/*')
.pipe(gulp.dest('lib'))
.pipe(gulp.dest('es'));
});
gulp.task('es6Module', () => {
return gulp.src('src/**/*.js').pipe(gulp.dest('es'));
});
gulp.task('build', [
'babel', 'stylus-compile',
'stylus-source', 'font',
'es6Module'
]);
gulp.task('clean', () => {
return gulp.src('lib', {read: false}).pipe(clean());
});
gulp.task('rebuild', ['clean', 'build']);
gulp.task('sync-md-font', () => {
return gulp
.src([
'./node_modules/material-design-icons/iconfont/MaterialIcons-Regular.*',
'./node_modules/material-design-icons/iconfont/codepoints'
])
.pipe(gulp.dest('./src/common/font/'));
});