-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
58 lines (49 loc) · 1.5 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
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
KarmaServer = require('karma').Server,
browserify = require('browserify'),
source = require('vinyl-source-stream'),
livereload = require('gulp-livereload'),
opn = require('opn'),
browserSync = require('browser-sync').create(),
plumber = require('gulp-plumber');
gulp.task('test', function (done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});
gulp.task('js', function () {
return gulp.src(['src/*.js', 'spec/*.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('browserify', function () {
return browserify('src/js/app.js')
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('build/js'));
});
gulp.task('watch', ['browserify'], function () {
livereload.listen(35729);
var watch = gulp.watch(['src/**', 'index.html'], ['reload']);
});
gulp.task('reload', ['browserify'], function() {
gulp.src(['index.html', 'src/css/*.css', 'build/js/bundle.js'])
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(livereload())
.pipe(browserSync.stream());
});
gulp.task('bs', ['browserify'], function() {
var files = [
'index.html',
'build/js/bundle.js',
'src/css/*.css'
];
browserSync.init(files, {
server: '.'
});
});
//gulp.task('default', ['js', 'test']);
gulp.task('default', ['watch', 'bs']);