-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
75 lines (65 loc) · 2.04 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
63
64
65
66
67
68
69
70
71
72
73
74
75
var gulp = require('gulp');
var concat = require('gulp-concat');
var clean = require('gulp-clean');
var babel = require('gulp-babel');
var add = require('gulp-add-src');
var rename = require('gulp-rename');
var gls = require('gulp-live-server');
var karma = require('karma').server;
/**
* Minify and concat component files into a file included by the index.
*/
gulp.task('build', function() {
return gulp.src([
'./app/module.js',
'./app/services/**/*.js',
'./app/components/**/*.js',
'./app/layout/**/*.js',
'./app/routes.js'
])
.pipe(babel())
.pipe(add.prepend([
'./node_modules/jquery/dist/jquery.js',
'./node_modules/angular/angular.js',
'./node_modules/immutable/dist/immutable.js',
'./node_modules/ramda/dist/ramda.js',
'./node_modules/reflux/dist/reflux.js',
'./node_modules/baconjs/dist/Bacon.js',
'./node_modules/pouchdb/dist/pouchdb.js',
'./node_modules/cuid/dist/browser-cuid.js',
'./node_modules/angular-ui-router/release/angular-ui-router.js'
]))
.pipe(concat('app.js'))
.pipe(gulp.dest('./app/_build'));
});
gulp.task('styles', function() {
return gulp.src('node_modules/todomvc-app-css/index.css')
.pipe(rename('app.css'))
.pipe(gulp.dest('./app/_build'));
});
/********************************************************/
gulp.task('clean', function() {
return gulp.src(['./app/_build/app.js'], {read: false})
.pipe(clean());
});
gulp.task('test', ['build'], function(done) {
return karma.start({
configFile: require('path').resolve('karma.conf.js'),
singleRun: true
}, function() {
done();
});
});
gulp.task('develop', ['build', 'styles'], function(done) {
var server = gls.static('app', process.env.PORT || 8000);
server.start();
karma.start({
configFile: require('path').resolve('karma.conf.js')
});
return gulp.watch(['./app/**/*.js', '!./app/_build/**/*.js'], ['build']);
});
gulp.task('serve', ['build', 'styles'], function() {
var server = gls.static('app', process.env.PORT || 8000);
server.start();
});
gulp.task('default', ['serve']);