forked from grizzthedj/react-session
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (47 loc) · 1.29 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
const gulp = require('gulp');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const demoConfig = require('./webpack.config.demo.js');
const babel = require('gulp-babel');
const shell = require('gulp-shell');
const del = require('del');
gulp.task('clean-build', function() {
return del(['./dist/*.js']);
});
gulp.task('clean-demo', function() {
return del(['./demo/public/*.js']);
});
gulp.task('build-component', gulp.series('clean-build', async function() {
gulp.src(['./src/**/*.js', './src/*js'])
.pipe(babel())
.pipe(gulp.dest('./dist'));
}));
gulp.task('build', gulp.series(['clean-build', 'clean-demo'], shell.task([
'gulp build-component',
'webpack --config webpack.config.build-demo.js'
])));
gulp.task('demo', function() {
new WebpackDevServer(webpack(demoConfig), {
publicPath: "/",
contentBase: "demo/",
hot: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
stats: {
assets: true,
colors: true,
version: false,
hash: false,
timings: true,
chunks: true,
chunkModules: false
},
historyApiFallback: true
}).listen(8080, 'localhost', function(err, result) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:8080');
});
});