-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
49 lines (42 loc) · 1.39 KB
/
Copy pathgulpfile.js
File metadata and controls
49 lines (42 loc) · 1.39 KB
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
var gulp = require('gulp');
var del = require('del');
var minify = require('gulp-minify');
var minifyCSS = require('gulp-minify-css');
var jshint = require('gulp-jshint');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var wrap = require('gulp-wrap');
var header = require('gulp-header');
gulp.task('clean', function (cb) {
del([
'temp',
'dist',
], cb);
});
gulp.task('lint',function(){
return gulp.src('src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
}); // end lint
gulp.task('concat-js',function(){
return gulp.src(['src/rest-main.js','src/rest-service.js'])
.pipe(concat('rest.js'))
.pipe(wrap('(function(){\n<%= contents %>\n})();'))
.pipe(gulp.dest('.tmp'));
}); // end concat-js
gulp.task('compress-js',['concat-js'],function(){
var bower = require('./bower.json');
var banner = ['/**',
' * <%= bower.name %> - <%= bower.description %>',
' * @version v<%= bower.version %>',
' * @author <%= bower.authors[0].name %>, <%= bower.authors[0].email %>',
' * @license <%= bower.licenses[0].type %>, <%= bower.licenses[0].url %>',
' */',
''].join('\n');
gulp.src(['.tmp/rest.js'])
.pipe(header(banner, {bower : bower}))
.pipe(minify({}))
.pipe(gulp.dest('dist'));
}); // end comrpess-js
gulp.task('default',['clean', 'lint','compress-js']);