-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (33 loc) · 1021 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
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var connect = require('gulp-connect');
var jshint = require('gulp-jshint');
gulp.task('default', ['serve', 'watch']);
gulp.task('watch', ['build', 'lint'], function() {
gulp.watch(['app.js', './modules/*.*'], ['build']);
gulp.watch(['./pub/*.*'], ['reload', 'lint']);
});
gulp.task('build', function() {
return browserify('./app.js')
.bundle()
// Pass desired output filename to vinyl-source-stream
.pipe(source('bundle.js'))
// Start piping stream to tasks!
.pipe(gulp.dest('./pub/'));
});
gulp.task('serve', function () {
connect.server({
root: 'pub',
livereload: true
});
});
gulp.task('reload', function () {
gulp.src(['./pub/*.*', './modules/*.*'])
.pipe(connect.reload());
});
gulp.task('lint', function () {
return gulp.src(['./modules/*.js', './app.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
});