-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (51 loc) · 1.31 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
50
51
52
53
54
55
56
57
58
59
60
61
62
'use strict';
var gulp = require('gulp');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var browserSync = require('browser-sync')
var reload = browserSync.reload;
var browserify = require('gulp-browserify');
// var gulpChild = require('./gulp-child');
// var restart = gulpChild.restart;
var rename = require('gulp-rename');
var paths = {
scripts: ['**/*.js', '!coverage/**/*.js', '!node_modules/**/*.js', '!public/**/*.js']
};
var watchConfig = {
app : ['app.js'],
js : ['test.js']
};
gulp.task('build', function(){
gulp.src('./test.js')
.pipe(browserify({
insertGlobals : true,
debug : !gulp.env.production
}))
.pipe(rename('test_pre.js'))
.pipe(gulp.dest('./'));
});
gulp.task('server', function() {
browserSync.init({
server : {
baseDir : './'
},
port : 8888
})
});
gulp.task('watch', function() {
gulp.watch(watchConfig.app).on('change', reload)
gulp.watch(watchConfig.js, ['build']).on('change', reload)
});
gulp.task('jshint', function() {
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('jscs', function() {
return gulp.src(paths.scripts)
.pipe(jscs())
.pipe(jscs.reporter());
});
gulp.task('lint', ['jshint', 'jscs']);
gulp.task('default', ['server', 'watch']);