forked from oblador/angular-scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (52 loc) · 1.59 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
var gulp = require('gulp');
var clean = require('gulp-rimraf');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var ngmin = require('gulp-ng-annotate');
var sourcemaps = require('gulp-sourcemaps');
var karma = require('karma').server;
var karmaConfPath = './test/karma.conf.js';
var karmaConf = require(karmaConfPath);
var sources = [
'src/module.js',
'src/helpers.js',
'src/services/request-animation.js',
'src/services/spy-api.js',
'src/services/scroll-container-api.js',
'src/directives/smooth-scroll.js',
'src/directives/spy-context.js',
'src/directives/scroll-container.js',
'src/directives/scrollspy.js'
];
var targets = 'angular-scroll.{js,min.js,min.js.map}';
gulp.task('clean', function() {
gulp.src(targets)
.pipe(clean());
});
gulp.task('lint', function() {
gulp.src(sources)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('karma', function(done) {
karma.start({configFile: __dirname + '/test/karma.conf.js', singleRun: true}, done);
});
gulp.task('compress', function() {
//Development version
gulp.src(sources)
.pipe(concat('angular-scroll.js', { newLine: '\n\n' }))
.pipe(ngmin())
.pipe(gulp.dest('./'));
//Minified version
gulp.src(sources)
.pipe(sourcemaps.init())
.pipe(concat('angular-scroll.min.js', { newLine: '\n\n' }))
.pipe(ngmin())
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./'));
});
gulp.task('build', ['clean', 'compress']);
gulp.task('test', ['lint', 'karma']);
gulp.task('default', ['test', 'build']);