-
Notifications
You must be signed in to change notification settings - Fork 21
/
gulpfile.js
51 lines (45 loc) · 1 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
const gulp = require('gulp');
const gutil = require('gulp-util');
const babel = require('gulp-babel');
const webpack = require('webpack');
require('babel-polyfill');
const WEBPACK_CONFIG = {
entry: [
'babel-polyfill',
'./target/bondage.js',
],
output: {
path: './dist',
filename: 'bondage.min.js',
libraryTarget: 'var',
library: 'bondage',
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
],
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' },
],
},
node: {
fs: 'empty',
},
};
gulp.task('default', ['webpack']);
gulp.task('babel', () => {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('target'));
});
gulp.task('webpack', ['babel'], (callback) => {
webpack(WEBPACK_CONFIG, (err, stats) => {
if (err) throw new gutil.PluginError('webpack', err);
gutil.log('[webpack]', stats.toString({
colors: true,
progress: true,
}));
callback();
});
});