-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (41 loc) · 1.09 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
var browserify = require('browserify');
var gulp = require('gulp');
var file = require('./handle/lib/file');
var source = require('vinyl-source-stream');
var notify = require('gulp-notify');
var watchify = require('watchify');
gulp.task('clean', function(cb){
file.dele(['build/*'], {dot: true});
file.create('build/');
cb();
})
// gulp.task('copyStatic', ['clean'], function(cb){
// file.copy('ui/index.html', 'build/index.html');
// file.copy('ui/style.css', 'build/style.css');
// file.copy('handle/jquery.min.js', 'build/jquery.min.js');
// cb();
// })
gulp.task('build', ['clean'], function(){
var process = browserify({
entries: ['handle/server.js'],
cache: {},
packageCache: {},
plugin: [watchify]
})
var handle = function(){
return process
.bundle()
.on('error', function(){
var args = Array.prototype.slice.call(arguments);
notify.onError({
title: "Compile Error",
message: "<%= error.message %>"
}).apply(this, args);
this.emit('end');
})
.pipe(source('serverd.js'))
.pipe(gulp.dest('build'))
}
process.on('update', handle);
handle();
})