This repository has been archived by the owner on Oct 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
66 lines (53 loc) · 1.39 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
'use strict';
var gulp = require('gulp');
var karma = require('karma');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var stylish = require('jshint-stylish');
var config = {
test: __dirname + '/test/karma.conf.js',
src: [
'./src/in-viewport.module.js',
'./src/directives/*.js'
],
dist: './dist/'
};
// Run karma unit tests
gulp.task('karma', function (done) {
var karmaConfig = {
configFile: config.test,
singleRun: true
};
var server = new karma.Server(karmaConfig, karmaCallback);
server.start();
function karmaCallback ()
{
done();
}
});
// JSHint the source files
gulp.task('jshint', function () {
return gulp.src(config.src)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
// Copy src to dist
gulp.task('build-regular', ['test'], function () {
return gulp
.src(config.src)
.pipe(concat('in-viewport.js'))
.pipe(gulp.dest(config.dist));
});
// Copy minified src to dist
gulp.task('build-minified', ['test'], function () {
return gulp
.src(config.src)
.pipe(uglify())
.pipe(concat('in-viewport.min.js'))
.pipe(gulp.dest(config.dist));
});
// Run tests
gulp.task('test', ['jshint', 'karma']);
// Build
gulp.task('build', ['test', 'build-regular', 'build-minified']);