forked from fabiospampinato/cash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (40 loc) · 1.13 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
'use strict';
var gulp = require('gulp');
var pkg = require('./package.json');
var $ = require('gulp-load-plugins')();
gulp.task('build', function () {
return gulp.src('./src/_wrapper.js')
.pipe($.preprocess({
context: {
header: '/*! ' + pkg.name + ' '+pkg.version +', '+pkg.homepage +' @license '+ pkg.license +' */'
}
}))
.pipe($.rename('cash.js'))
.pipe($['6to5']())
.pipe($.size())
.pipe($.size({ gzip: true }))
.pipe(gulp.dest('./dist/'));
});
gulp.task('minify', ['build'], function() {
return gulp.src(['./dist/cash.js'])
.pipe($.uglify({
preserveComments: 'license'
}))
.pipe($.size())
.pipe($.size({ gzip: true }))
.pipe($.rename('cash.min.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('lint', function() {
return gulp.src(['src/*.js', '!src/_*.js'])
.pipe($.jshint())
.pipe($.jshint.reporter('default'));
});
gulp.task('test', function() {
return gulp.src('./test/index.html')
.pipe($.qunit());
});
gulp.task('default', ['build', 'minify', 'lint']);
gulp.task('watch', function() {
gulp.watch(['src/*.js', 'test/src/*.js'], ['default']);
});