forked from kstam/ng-scroll-repeat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
74 lines (62 loc) · 1.89 KB
/
gulpfile.js
File metadata and controls
74 lines (62 loc) · 1.89 KB
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
// Include gulp
var gulp = require('gulp');
// Include Gulp Plugins
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var bower = require('gulp-bower');
var header = require('gulp-header');
var karma = require('karma').server;
var fs = require('fs');
var getCopyright = function() {
return fs.readFileSync('source/Copyright');
};
var getVersion = function() {
var bowerFile = fs.readFileSync('bower.json');
return JSON.parse(bowerFile).version;
};
gulp.task('lint', function() {
return gulp.src('source/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest('libs/'));
});
gulp.task('test', function(done) {
// Be sure to return the stream
karma.start({
configFile: __dirname + '/test/config/karma.conf.js',
singleRun: true
}, done);
});
gulp.task('testDist', function(done) {
// Be sure to return the stream
karma.start({
configFile: __dirname + '/test/config/karma.conf.dist.js',
singleRun: true
}, done);
});
gulp.task('testDistMin', function(done) {
// Be sure to return the stream
karma.start({
configFile: __dirname + '/test/config/karma.conf.distMin.js',
singleRun: true
}, done);
});
gulp.task('dist', function() {
return gulp.src('source/*.js')
.pipe(concat('ng-scroll-repeat.js'))
.pipe(header(getCopyright(), {version: getVersion()}))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(header(getCopyright(), {version: getVersion()}))
.pipe(rename('ng-scroll-repeat.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function() {
gulp.watch('source/*.js', ['lint', 'test']);
});
gulp.task('default', ['lint', 'bower', 'test', 'dist', 'testDist', 'testDistMin']);