-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathgulpfile.js
46 lines (38 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
var del = require('del')
, gulp = require('gulp')
, header = require('gulp-header')
, rename = require('gulp-rename')
, 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.shapes.js')
.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.shapes.js')
.pipe(uglify())
.pipe(rename({ suffix:'.min' }))
.pipe(header(headerShort, { pkg: pkg }))
.pipe(gulp.dest('dist'))
})
gulp.task('default', ['clean', 'copy', 'minify'])