-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
53 lines (46 loc) · 1.27 KB
/
gulpfile.babel.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
53
import gulp from 'gulp';
import tape from 'gulp-tape';
import eslint from 'gulp-eslint';
import tapColorize from 'tap-colorize';
import webpack from 'webpack';
import webpackDevServer from 'webpack-dev-server';
import webpackConfig from './webpack.config.babel.js';
gulp.task('static', function(callback) {
return gulp.src('./app/index.html')
.pipe(gulp.dest('./dist'));
});
gulp.task('webpack', function(callback) {
webpack(webpackConfig, function(err, stats) {
if(err) {
console.log('ERROR', err);
}
callback();
});
});
gulp.task('webpack-dev-server', function(callback) {
new webpackDevServer(webpack(webpackConfig), {
contentBase: webpackConfig.output.path,
stats: {
colors: true
}
}).listen(8080, 'localhost', function(err) {
if(err) {
console.log('ERROR', err);
}
})
});
gulp.task('test', function() {
return gulp.src('test/**/*.js')
.pipe(tape({
reporter: tapColorize()
}));
});
gulp.task('lint', function() {
return gulp.src(['app/**/*.js', 'test/**/*.js'])
.pipe(eslint({ useEslintrc: true }))
.pipe(eslint.formatEach('compact', process.stderr));
});
gulp.task('watch', function() {
gulp.watch('./app/index.html', ['static'])
});
gulp.task('default', ['webpack-dev-server', 'static', 'watch']);