-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
60 lines (50 loc) · 1.43 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
/**
* Build Process
*/
'use strict';
var gulp = require('gulp');
var wrench = require('wrench');
var gutil = require('gulp-util');
var path = require('path');
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
var filter = require('gulp-filter');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglifySaveLicense = require('uglify-save-license');
/**
* Common implementation for an error handler of a Gulp plugin
*/
var errorHandler = function(title) {
'use strict';
return function(err) {
gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
this.emit('end');
};
};
var paths = {
src: ['src/jwplayer.module.js', 'src/jwplayer.service.js', 'src/jwplayer.directive.js'],
dist: '.',
jsFile: 'jwplayer.js',
jsMinFile: 'jwplayer.min.js'
};
var jsFilter = filter('src/**/*.js');
gulp.task('build', function() {
return gulp.src(paths.src)
.pipe(ngAnnotate())
.pipe(concat(paths.jsFile))
.pipe(gulp.dest(paths.dist))
.pipe(uglify({ preserveComments: uglifySaveLicense })).on('error', errorHandler('Uglify'))
.pipe(rename(paths.jsMinFile))
.pipe(gulp.dest(paths.dist));
});
// configure the jshint task
gulp.task('jshint', function() {
return gulp.src(paths.src)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
// default
gulp.task('default', ['build'], function() {
});