forked from garrows/browser-serialport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (36 loc) · 999 Bytes
/
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
var gulp = require('gulp'),
browserify = require('gulp-browserify'),
jshint = require('gulp-jshint'),
jshintReporter = require("jshint-stylish");
gulp.task("jshint", function() {
return gulp.src(["./demo/*.js"])
.pipe(jshint())
.pipe(jshint.reporter(jshintReporter));
});
gulp.task('browserify', function() {
return gulp.src(['./demo/demo.js'])
.pipe(browserify({
debug : true,
"fullPaths": true
}))
.pipe(gulp.dest('./demo/build/'))
.on('end', livereload('.js'));
});
var livereloadServer = null;
var livereload = function (_file) {
return function (_path) {
if (livereloadServer) livereloadServer.changed(_file);
}
}
gulp.task('watch', function() {
livereloadServer = require('gulp-livereload')();
gulp.watch(['./demo/**/*.js', './*.js'], ['build']);
});
gulp.task('build', [
'jshint',
'browserify'
]);
gulp.task('default', [
'watch',
'build'
]);