forked from clarketm/TableExport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (64 loc) · 2.18 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
var gulp = require('gulp'),
replace = require('gulp-replace'),
bump = require("gulp-bump"),
rename = require("gulp-rename"),
del = require('del'),
css = require('gulp-clean-css');
js = require('gulp-uglify');
gulp.task('css', ['clean'], function () {
return gulp.src('./src/stable/css/tableexport.css')
.pipe(gulp.dest('./dist/css/'))
.pipe(css())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist/css/'))
.pipe(gulp.dest('./src/stable/css/'));
});
gulp.task('js', ['clean'], function () {
return gulp.src('./src/stable/js/tableexport.js')
.pipe(gulp.dest('./dist/js/'))
.pipe(js({output: {comments: /^!|@preserve|@license|@cc_on/i}}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist/js/'))
.pipe(gulp.dest('./src/stable/js/'));
});
gulp.task('typings', ['clean'], function () {
return gulp.src('./src/stable/typings/*.ts')
.pipe(gulp.dest('./dist/typings/'));
});
gulp.task('bump', ['bump-js', 'bump-css'], function(){
return gulp.src(['./bower.json', './package.json'])
.pipe(bump())
.pipe(gulp.dest('./'));
});
gulp.task('bump-js', function () {
return gulp.src(['src/stable/js/tableexport.js'])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2)+1);
}))
.pipe(replace(/(version: "\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2)+1);
}))
.pipe(gulp.dest('src/stable/js/'))
.on('end', function () {
gulp.start('js');
});
});
gulp.task('bump-css', function () {
gulp.src(['src/stable/css/tableexport.css'])
.pipe(replace(/(v\d+\.\d+\.)(\d+)/g, function (matches, match1, match2) {
return match1 + (Number(match2) + 1);
}))
.pipe(gulp.dest('src/stable/css/'))
.on('end', function () {
gulp.start('css');
});
});
gulp.task('clean', function () {
return del(['dist/js']);
});
gulp.task('build', ['css', 'js', 'typings']);
gulp.task('default', ['build']);