-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
48 lines (41 loc) · 1.12 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
const { src, dest, series, watch } = require('gulp');
const browserSync = require('browser-sync');
const wiredep = require('wiredep').stream;
const inject = require('gulp-inject');
const karma = require('karma').server;
function watchTask() {
browserSync({
ui: false,
port: 3005,
notify: false,
open: false,
server: {
baseDir: './app'
}
});
watch(['app/**/*', '!app/bower_components/**/*']).on('change', browserSync.reload);
};
function bower() {
return src('app/index.html')
.pipe(wiredep({ optional: 'configuration', goes: 'here', devDependencies: true }))
.pipe(dest('app'));
};
function injectTask() {
var sources = src(
['./app/scripts/app.js',
'!./app/**/*.min.js',
'./app/scripts/*.js'],
{ read: false });
return src('app/index.html')
.pipe(inject(sources, { ignorePath: 'app' }))
.pipe(dest('app'));
};
function testTask() {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: false
});
};
exports.default = series(bower, injectTask);
exports.serve = series(bower, injectTask, watchTask);
exports.test = series(bower, testTask);