forked from cs-slick/slick
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGulpfile.js
More file actions
45 lines (38 loc) · 1.08 KB
/
Gulpfile.js
File metadata and controls
45 lines (38 loc) · 1.08 KB
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
const gulp = require('gulp');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const watchify = require('watchify');
const gutil = require('gulp-util');
const nodemon = require('gulp-nodemon');
const uglify = require('gulp-uglify');
const streamify = require('gulp-streamify');
const notify = require('gulp-notify');
// const gzip = require('gulp-gzip');
const b = watchify(browserify({
entries: './src/index.js',
cache: {},
packageCache: {},
debug: true,
require: ['react', 'react-dom'],
}));
gulp.task('watch:js', bundle);
b.on('update', bundle);
function bundle() {
return b
.transform('babelify', { presets: ['es2015', 'react'] })
.bundle()
.on('error', gutil.log)
.pipe(source('bundle.js'))
.pipe(streamify(uglify('./dist/')))
// .pipe(streamify(gzip({ append: true })))
.pipe(gulp.dest('./'))
.pipe(notify('Built Bundle'));
}
gulp.task('nodemon', serve);
function serve() {
nodemon({
script: 'server/server.js',
ignore: ['client/', 'build/'],
});
}
gulp.task('default', ['watch:js', 'nodemon']);