-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
48 lines (42 loc) · 1.16 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
/**
* Created by JLou on 4/14/2016.
*/
var gulp = require('gulp');
var webpack = require('webpack-stream');
var rename = require('gulp-rename');
var stripDebug = require('gulp-strip-debug');
var nodemon = require('gulp-nodemon');
var install = require('gulp-install');
var uglify = require('gulp-uglify');
var server = require('gulp-develop-server');
gulp.task('webpack', function () {
return gulp.src('index.js')
.pipe(webpack(require('./webpack.config.js')))
.pipe(rename('bundle.js'))
.pipe(gulp.dest('public/build'));
});
gulp.task('clean', ['webpack'], function () {
return gulp.src('public/build/bundle.js')
.pipe(uglify())
.pipe(stripDebug())
.pipe(gulp.dest('public/build'));
});
/**
* start in development mode
*/
gulp.task('start-dev', ['webpack'], function () {
nodemon({
script: 'server.js',
env: {'NODE_ENV': 'development'}
})
});
/**
* start in production mode
*/
gulp.task('start-pro', ['clean'], function () {
server.listen({path: './server.js', env: {NODE_ENV: 'production'}});
});
gulp.task('install', function () {
gulp.src(['package.json'])
.pipe(install());
});