-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
executable file
·66 lines (54 loc) · 1.39 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
const gulp = require('gulp');
const gutil = require('gutil');
const babel = require('gulp-babel');
const nodemon = require('gulp-nodemon');
const runSequence = require('run-sequence');
const rimraf = require('rimraf');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config.js');
const statsConfig = {
colors: true,
chunks: false,
modules: false,
hash: false,
version: false
};
gulp.task('dev', ()=>
nodemon({
script: './examples/lib',
watch: ['./src', './examples/src'],
tasks: ['build:dev', 'build:examples']
})
);
gulp.task('clean:dev', (cb) =>
rimraf('./dev', cb)
);
gulp.task('clean:examples', (cb) =>
rimraf('./examples/lib', cb)
);
gulp.task('clean:lib', (cb) =>
rimraf('./lib', cb)
);
gulp.task('clean', (cb)=>
runSequence(['clean:dev', 'clean:examples', 'clean:lib'], cb)
);
gulp.task('build:dev', () =>
gulp.src('./src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('./dev'))
);
gulp.task('build:examples', () =>
gulp.src('./examples/src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('./examples/lib'))
);
gulp.task('build:lib', function(cb) {
webpack(webpackConfig, function(err, stats) {
if(err) throw new gutil.PluginError('webpack:build', err);
gutil.log('[webpack:build]', stats.toString(statsConfig));
cb();
});
});
gulp.task('build', (cb)=>
runSequence(['build:dev', 'build:examples', 'build:lib'], cb)
);