-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
53 lines (47 loc) · 1.34 KB
/
gulpfile.js
File metadata and controls
53 lines (47 loc) · 1.34 KB
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
var gulp = require('gulp');
var connect = require('gulp-connect');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var ngHtml2Js = require('browserify-ng-html2js');
var eslint = require('gulp-eslint');
var KarmaServer = require('karma').Server;
var config = {
scripts: './app/**/*.js',
main: './app/main.js',
watch: './app/**/*',
dest: {
dir: './public/js/',
main: 'main.js'
},
ngHtml2Js: { module: 'templates' },
babelify: { presets: ['es2015'] },
connect: {
root: 'public',
port: 4000
},
karma: {
configFile: __dirname + '/karma.conf.js',
singleRun: true
}
};
gulp.task('lint', function() {
return gulp.src([config.scripts])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('browserify', ['lint'], function() {
return browserify(config.main)
.transform(ngHtml2Js(config.ngHtml2Js))
.transform('babelify', config.babelify)
.bundle()
.pipe(source(config.dest.main))
.pipe(gulp.dest(config.dest.dir));
});
gulp.task('connect', ['browserify'], function() {
connect.server(config.connect);
gulp.watch(config.watch, ['browserify']);
});
gulp.task('test', function(done) {
new KarmaServer(config.karma, done).start();
});