-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
45 lines (41 loc) · 1.14 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
'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 = ['/**',
'* Reve v${version}',
'* (c) 2015 ${author}',
'* Released under the ${license} License.',
'*/',
''].join('\n')
var bannerVars = {
version : meta.version,
author: 'guankaishe',
license: 'MIT'
}
gulp.task('watch', function () {
watch(['lib/*.js', 'reve.js'], function () {
gulp.start('default')
})
});
gulp.task('default', function() {
return gulp.src('reve.js')
.pipe(webpack({
output: {
library: 'Reve',
libraryTarget: 'umd',
filename: 'reve.js'
}
}))
.pipe(header(banner, bannerVars))
.pipe(gulp.dest('dist/'))
.pipe(uglify('reve.min.js', {
mangle: true,
compress: true
}))
.pipe(header(banner, bannerVars))
.pipe(gulp.dest('dist/'))
});