-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.babel.js
50 lines (45 loc) · 1.16 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import babel from 'gulp-babel';
import uglify from 'gulp-uglify';
import rename from 'gulp-rename';
import { rollup } from 'rollup';
import babelRollup from 'rollup-plugin-babel';
import sequence from 'run-sequence';
gulp.task('default', ['build']);
gulp.task('build', () => {
return sequence(['build:lib', 'build:dist'], ['build:min']);
});
gulp.task('build:lib', () => {
return gulp.src(['src/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('lib'));
});
gulp.task('build:dist', () => {
return rollup({
entry: 'src/index.js',
plugins: [
babelRollup({
babelrc: false,
presets: [
[ 'es2015', { modules: false } ]
]
})
]
}).then((bundle) => {
return bundle.write({
format: 'umd',
moduleName: 'mware',
dest: 'dist/mware.js'
});
});
});
gulp.task('build:min', () => {
return gulp.src(['dist/**/*.js'])
.pipe(uglify({
mangle: true
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist'));
});