forked from P1XELWAY/svg.resize.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (49 loc) · 1.42 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
var del = require('del')
, gulp = require('gulp')
, header = require('gulp-header')
, iife = require('gulp-iife')
, rename = require('gulp-rename')
, stand = require('gulp-standard')
, trim = require('gulp-trimlines')
, uglify = require('gulp-uglify')
, pkg = require('./package.json')
var headerLong = ['/*!'
, '* <%= pkg.name %> - <%= pkg.description %>'
, '* @version <%= pkg.version %>'
, '* <%= pkg.homepage %>'
, '*'
, '* @copyright <%= pkg.author %>'
, '* @license <%= pkg.license %>'
, '*/;'
, ''].join('\n')
var headerShort = '/*! <%= pkg.name %> v<%= pkg.version %> <%= pkg.license %>*/;'
gulp.task('clean', function() {
return del([ 'dist/*' ])
})
gulp.task('copy', ['clean'], function() {
return gulp.src('src/svg.resize.js')
.pipe(iife())
.pipe(header(headerLong, { pkg: pkg }))
.pipe(trim({ leading: false }))
.pipe(gulp.dest('dist'))
})
/**
* uglify the file
* add the license info
*/
gulp.task('minify', ['copy'], function() {
return gulp.src('dist/svg.resize.js')
.pipe(uglify())
.pipe(rename({ suffix:'.min' }))
.pipe(header(headerShort, { pkg: pkg }))
.pipe(gulp.dest('dist'))
})
gulp.task('standard', function () {
return gulp.src(['./svg.resize.js'])
.pipe(stand())
.pipe(stand.reporter('default', {
breakOnError: true,
quiet: false
}))
})
gulp.task('default', ['standard', 'clean', 'copy', 'minify'])