-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
69 lines (58 loc) · 1.83 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var template = require('gulp-template');
var sourcemaps = require('gulp-sourcemaps');
var KarmaServer = require('karma').Server;
var bower = require('./bower.json');
var dist_dir = './'
var dist_file = 'launchpad.js';
gulp.task('version', function(){
return gulp.src('template/version.js')
.pipe(template(bower))
.pipe(gulp.dest('src/'));
});
gulp.task('jshint-source', [], function(){
return gulp.src(['src/**.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('concat', ['version', 'jshint-source'], function(){
return gulp.src(['src/observer.js', 'src/**.js'])
.pipe(concat(dist_file, { newLine: ';' }))
.pipe(gulp.dest(dist_dir));
});
gulp.task('jshint-concat', ['concat'], function(){
return gulp.src(dist_file)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('jshint', ['jshint-source', 'jshint-concat'], function(){
/* do nothing */
});
gulp.task('compress', ['concat'], function(){
return gulp.src(dist_file)
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dist_dir));
});
gulp.task('test', ['compress'], function(done){
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start()
});
gulp.task('tdd', ['compress'], function(done){
new KarmaServer({
configFile: __dirname + '/karma.conf.js'
}, done).start()
});
gulp.task('default', ['compress'], function(){
/* noting to do here */
});