-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
76 lines (65 loc) · 2.17 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
76
(function(){
'use strict';
var gulp = require('gulp'),
clean = require('del'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
gutil = require('gulp-util'),
rename = require('gulp-rename'),
path = require('path'),
plumber = require('gulp-plumber'),
runSequence = require('run-sequence'),
header = require('gulp-header'),
pkg = require('./package.json'),
jshint = require('gulp-jshint'),
karma = require('karma').server,
sourceFiles = ['src/*.sdk.js','src/*.module.js','src/*.provider.js','src/*.directives.js','src/*.factory.js'],
banner = ['/*!',
' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= date %>',
' * <%= pkg.homepage %>',
' * Copyright (c) <%= year %> <%= pkg.author %>;',
' * Licensed',
' */',
''].join('\n');
gulp.task('clean', function(cb) {
clean("dist", cb);
});
gulp.task('jshintSrc', function () {
return gulp.src(sourceFiles)
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
});
gulp.task('makeSourceFiles',function(){
gulp.src(sourceFiles)
.pipe(plumber())
.pipe(header(banner, { pkg : pkg, date : gutil.date("yyyy-mm-dd"), year : gutil.date("yyyy")}))
.pipe(concat('angular-contentstack.js'))
.pipe(gulp.dest('./dist/'))
.pipe(uglify())
.pipe(rename('angular-contentstack.min.js'))
.pipe(gulp.dest('./dist'))
});
// gulp.task('build', function(done) {
// runSequence('jshintSrc', 'clean', 'makeSourceFiles', done)
// });
gulp.task('build', function(done) {
runSequence('clean', 'makeSourceFiles', done)
});
gulp.task('watchTask', function (done) {
runSequence('build', done)
});
gulp.task('watch', function () {
gulp.watch(sourceFiles, ['watchTask']);
});
gulp.task('default', function () {
runSequence('build', 'watch')
});
gulp.task('test-src', function (done) {
karma.start({
configFile: __dirname + '/karma-src.conf.js',
singleRun: true
}, done);
});
})();