-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (43 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
'use strict';
var gulp = require('gulp')
var webpack = require('gulp-webpack')
var uglify = require('gulp-uglifyjs')
var header = require('gulp-header')
var meta = require('./package.json')
var watch = require('gulp-watch')
var banner = ['/**',
'* Chainjs v${version}',
'* http://github.com/switer/chainjs',
'*',
'* (c) 2015 ${author}',
'* Released under the ${license} License.',
'*/',
''].join('\n')
var bannerVars = {
version : meta.version,
author: 'guankaishe',
license: 'MIT'
}
gulp.task('watch', function () {
watch(['chain.js', 'lib/*.js'], function () {
gulp.start('default')
})
});
gulp.task('default', function() {
return gulp.src('chain.js')
.pipe(webpack({
output: {
library: 'Chain',
libraryTarget: 'umd',
filename: 'chain.js'
}
}))
.pipe(header(banner, bannerVars))
.pipe(gulp.dest('dist/'))
.pipe(uglify('chain.min.js', {
mangle: true,
compress: true
}))
.pipe(header(banner, bannerVars))
.pipe(gulp.dest('dist/'))
});