-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·37 lines (31 loc) · 982 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var gutil = require('gulp-util');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config');
// transpile each file from ES6 to ES5
// so that we can use the components in Node
gulp.task('babel-server', function() {
return gulp.src('./src/**/**/*.js')
.pipe(babel())
.on('error', gutil.log)
.pipe(gulp.dest('./src-es5'));
});
// transpile from ES6 to ES5
// and then bundle for client
gulp.task('babel-client', function () {
var myConfig = Object.create(webpackConfig);
// run webpack
webpack(myConfig, function(err, stats) {
if (err) throw new gutil.PluginError('webpack', err);
gutil.log('[webpack]', stats.toString({
colors: true,
progress: true
}));
});
});
gulp.task('watch', function() {
gulp.watch('./src/**/**/*.js', ['babel-server', 'babel-client']);
});
gulp.task('default', ['watch']);