-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
37 lines (33 loc) · 1.11 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
const gulp = require('gulp');
const open = require('open');
const del = require('del');
const webpack = require('webpack');
const gulpWebpack = require('webpack-stream');
const WebpackDevServer = require('webpack-dev-server');
const webpackDistConfig = require('./config/webpack.dist.config.js');
const webpackDevConfig = require('./config/webpack.config.js');
const path = require('path');
gulp.task('dev', () => {
const compiler = webpack(webpackDevConfig);
new WebpackDevServer(compiler, {
contentBase: './',
historyApiFallback: true,
hot: true,
noInfo: false,
publicPath: '/',
stats: { colors: true },
host: 'localhost'
}).listen(8090, 'localhost', () => {
console.log('http://127.0.0.1:8090');
console.log('Opening your system browser...');
open('http://127.0.0.1:8090');
});
});
gulp.task('default', ['dev']);
gulp.task('clean', () => {
console.log('build folder has been cleaned successfully');
return del(['build/**/*']);
});
gulp.task('build', ['clean'], () => gulp.src(path.join(__dirname, '../src'))
.pipe(gulpWebpack(webpackDistConfig))
.pipe(gulp.dest('build/')));