-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
60 lines (53 loc) · 1.42 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
53
54
55
56
57
58
59
60
"use strict";
let gulp = require('gulp');
let webpackStream = require('webpack-stream');
let nodemon = require('gulp-nodemon');
//let webpack2 = require("webpack");
let webpackConfig = {
devtool: "source-map",
output: {
filename: "app.js"
},
module :{
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: "babel"
},
{
test: /\.css$/,
loaders: ["style-loader", "css-loader"]
},
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
]
}
};
let webpack2Config = {
devtool: "source-map",
output: {
filename: "app.js"
}
};
gulp.task("compile:client", function(){
return gulp.src('./client/index.jsx')
.pipe(webpackStream(webpackConfig))
.pipe(gulp.dest('public/js/'));
});
gulp.task("watch:client", function(){
return gulp.src('./client/index.jsx')
.pipe(webpackStream(Object.assign(webpackConfig, {watch:true})))
.pipe(gulp.dest('public/js/'));
});
gulp.task("watch:app", function(){
var stream = nodemon({
script: './app.js',
ext: 'js',
ignore: ["client/*", "public/*"]
});
stream
.on('crash', function(){
stream.emit('restart', 10);
})
});
gulp.task('watch', ['watch:client', 'watch:app']);