-
Notifications
You must be signed in to change notification settings - Fork 180
/
gulpfile.js
53 lines (46 loc) · 1.22 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
var gulp = require('gulp');
var rimraf = require('gulp-rimraf');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var rename = require('gulp-rename');
var header = require('gulp-header');
var pkg = require('./package.json');
var banner = [
'/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' *',
' * @version <%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @author <%= pkg.author %>',
' * @copyright Zendesk',
' * @license <%= pkg.license %>',
' */\n\n'
].join('\n');
var paths = {
scripts: ['./lib/client.js', './lib/hub.js'],
dist: './dist/'
};
gulp.task('clean', function() {
gulp.src(paths.dist + '*', {read: false})
.pipe(rimraf());
});
gulp.task('copy', function() {
gulp.src(paths.scripts)
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest(paths.dist));
});
gulp.task('minify', function() {
gulp.src(paths.scripts)
.pipe(uglify())
.pipe(header(banner, {pkg: pkg}))
.pipe(rename(function(path) {
path.basename += '.min';
}))
.pipe(gulp.dest(paths.dist));
});
gulp.task('jshint', function() {
gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter());
});
gulp.task('dist', ['clean', 'copy', 'minify']);