-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (61 loc) · 1.8 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
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
livereload = require('gulp-livereload'),
copy = require('gulp-copy'),
connect = require('gulp-connect'),
open = require('gulp-open'),
del = require('del'),
Server = require('karma').Server;
var CONNECTION_PORT = 9000;
gulp.task('workflow:dev', ['test', 'connect', 'open'], function() {
gulp.watch('app/src/**', ['test']);
});
gulp.task('build', ['jshint', 'clean:build'], function() {
return gulp.src('app/src/**')
.pipe(gulp.dest('app/build'))
.pipe(connect.reload());
});
gulp.task('package', ['jshint', 'clean:package'], function() {
return gulp.src(['app/src/js/**/*.js', '!app/src/js/**/*.spec.js'])
.pipe(concat('ordinal.js'))
.pipe(gulp.dest('app/package/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('app/package/js'));
});
gulp.task('jshint', function() {
return gulp.src(['app/src/**/*.js', '!app/src/bower_components/**/*.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('clean:package', function() {
del(['app/package'])
});
gulp.task('clean:build', function() {
del(['app/build'])
});
gulp.task('test', ['build'], function (done) {
new Server({
configFile: __dirname + '/karma-unit.conf.js',
singleRun: true
}, done).start();
});
gulp.task('connect', function () {
connect.server({
root: 'app/build',
port: CONNECTION_PORT,
livereload: true
});
});
gulp.task('open', function () {
var options = {
uri: 'http://localhost:' + CONNECTION_PORT
};
gulp.src(__filename)
.pipe(open(options));
});