-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
64 lines (52 loc) · 1.49 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
/*
* race
*
* Copyright(c) 2014 André König <[email protected]>
* MIT Licensed
*
*/
/**
* @author André König <[email protected]>
*
*/
'use strict';
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var header = require('gulp-header');
var jasmine = require('gulp-jasmine');
var pkg = require('./package.json');
var paths = {};
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version <%= pkg.version %>',
' * @author <%= pkg.author.name %> (<%= pkg.author.email %>)',
' * @license <%= pkg.license %>',
' *',
' */', ''].join('\n');
paths.sources = ['./index.js', './index.spec.js'];
paths.lintables = ['./*.js'];
paths.component = './dist';
gulp.task('lint', function () {
return gulp.src(paths.lintables)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('test', function () {
return gulp.src(paths.sources)
.pipe(jasmine());
});
gulp.task('browserify:build', function () {
return gulp.src(paths.sources[0])
.pipe(browserify({
standalone: 'konexmedia.' + pkg.name
}))
.pipe(rename(pkg.name + '.min.js'))
.pipe(uglify())
.pipe(header(banner, {pkg : pkg}))
.pipe(gulp.dest(paths.component));
});
gulp.task('build', ['lint', 'test', 'browserify:build']);
gulp.task('default', ['build']);