-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (37 loc) · 1000 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
var gulp = require('gulp'),
browserify = require('browserify'),
buffer = require('gulp-buffer'),
gutil = require('gulp-util'),
jshint = require('gulp-jshint'),
source = require('vinyl-source-stream'),
sourcemaps = require('gulp-sourcemaps'),
stylish = require('jshint-stylish'),
uglify = require('gulp-uglify');
gulp.task('lint', function(){
return gulp.src('js/src/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('scripts', function(){
var bundler = browserify({
entries: ['./_js/app.js'],
debug: true
});
return bundler.bundle()
.on('error', function(err) {
gutil.log(err.message);
gutil.beep();
this.emit('end');
})
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.pipe(sourcemaps.write('./', {
sourceRoot: '../'
}))
.pipe(gulp.dest('./js'));
});
gulp.task('watch', ['scripts'], function(){
gulp.watch(['_js/**/*.js','_hbs/**/*.hbs'], ['scripts']);
});