-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.babel.js
60 lines (53 loc) · 1.22 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
54
55
56
57
58
59
60
import gulp from 'gulp';
import webpack from 'webpack-stream';
import BrowserSync from 'browser-sync';
import eslint from 'gulp-eslint';
import path from 'path';
import glob from 'glob';
const bs = BrowserSync.create();
gulp.task('js', () => {
return gulp.src('./src/*.jsx')
.pipe(webpack({
entry: {
demo: './src/demo',
'react-facial-feature-tracker': './src/react-facial-feature-tracker'
},
output: {
path: path.resolve('build'),
filename: '[name].js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: { presets: ['es2015', 'stage-0', 'react'] }
}
]
}
}))
.pipe(gulp.dest('build'))
.pipe(gulp.dest('demo/build'));
});
gulp.task('lint', () => {
return gulp.src('src/*.jsx')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('build', ['lint', 'js']);
gulp.task('watch', () => {
bs.init({
server: {
baseDir: './demo'
}
});
gulp.watch('src/*.jsx', ['js']);
gulp.watch('build/*.js').on('change', bs.reload);
gulp.watch('demo/*.html').on('change', bs.reload);
});
gulp.task('default', ['build', 'watch']);