forked from framework7io/framework7-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (75 loc) · 2.77 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(function () {
'use strict';
var gulp = require('gulp'),
header = require('gulp-header'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
rollup = require('rollup-stream'),
buble = require('rollup-plugin-buble'),
vue = require('rollup-plugin-vue2'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
rename = require('gulp-rename'),
pkg = require('./package.json'),
banner = [
'/**',
' * Framework7 Vue <%= pkg.version %>',
' * <%= pkg.description %>',
' * <%= pkg.homepage %>',
' * ',
' * Copyright <%= date.year %>, <%= pkg.author %>',
' * The iDangero.us',
' * http://www.idangero.us/',
' * ',
' * Licensed under <%= pkg.license %>',
' * ',
' * Released on: <%= date.month %> <%= date.day %>, <%= date.year %>',
' */',
''].join('\n');
gulp.task('dist', function (cb) {
rollup({
entry: './src/framework7-vue.js',
plugins: [vue(), buble()],
format: 'umd',
moduleName: 'Framework7Vue',
useStrict: false,
sourceMap: true
})
.pipe(source('framework7-vue.js', './src'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(header(banner, {
pkg: pkg,
date: (function () {
return {
year: new Date().getFullYear(),
month: ('January February March April May June July August September October November December').split(' ')[new Date().getMonth()],
day: new Date().getDate()
};
})()
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/'))
.on('end', function () {
gulp.src('./dist/framework7-vue.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(header(banner, {
pkg: pkg,
date: (function () {
return {
year: new Date().getFullYear(),
month: ('January February March April May June July August September October November December').split(' ')[new Date().getMonth()],
day: new Date().getDate()
};
})()
}))
.pipe(rename('framework7-vue.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/'))
.on('end', function () {
cb();
});
});
});
})();