-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
51 lines (49 loc) · 1.26 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
(function () {
'use strict';
var gulp = require('gulp');
var buffer = require('vinyl-buffer');
var del = require('del');
var gutil = require('gulp-util');
var rename = require('gulp-rename');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var webpack = require('gulp-webpack');
gulp.task('pack', function(){
return gulp.src('app/CrossRoads.js')
.pipe(webpack({
watch: true,
output: {
libraryTarget: 'var',
library: 'CrossRoads'
},
module: {
loaders: [
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015']
}
}
]
},
node: {
fs: 'empty'
}
}))
.pipe(rename('client.js'))
.pipe(gulp.dest('./web/build'))
.pipe(rename('client.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./web/build/'));
});
})();