-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
54 lines (42 loc) · 1.33 KB
/
gulpfile.babel.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
// generated on 2016-03-30 using generator-webapp 2.0.0
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import browserSync from 'browser-sync';
import del from 'del';
import { stream as wiredep } from 'wiredep';
// https://www.npmjs.com/package/gulp-live-server
var gls = require('gulp-live-server');
const $ = gulpLoadPlugins();
const reload = browserSync.reload;
function lint(files, options) {
return () => {
return gulp.src(files)
.pipe(reload({ stream: true, once: true }))
.pipe($.eslint(options))
.pipe($.eslint.format())
.pipe($.if(!browserSync.active, $.eslint.failAfterError()));
};
}
const testLintOptions = {
env: {
mocha: true
}
};
gulp.task('lint', lint('server/scripts/**/*.js'));
gulp.task('lint:test', lint('test/spec/**/*.js', testLintOptions));
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('serve', ['lint'], () => {
var server = gls.new('server/scripts/server.js');
server.start();
// gulp.watch([
// 'server/**/*'
// ]).on('change', reload);
gulp.watch('server/**/*', function() {
console.info('server changed, reloading');
gulp.start('lint');
server.start.bind(server)()
});
});
gulp.task('default', ['clean'], () => {
gulp.start('lint');
});