-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
37 lines (33 loc) · 1.06 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
var gulp = require('gulp'),
gulpConfig = require('./gulp.config'),
concat = require('gulp-concat'),
header = require('gulp-header'),
wrap = require('gulp-wrap'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename')
bump = require('gulp-bump');
gulp.task('default', ['build']);
gulp.task('build', function() {
return gulp.src(gulpConfig.srcFiles)
.pipe(concat('canvasImageSaver.js'))
.pipe(wrap("(function(global){\n'use strict';\n\n<%= contents %>\n})(this);"))
.pipe(header(gulpConfig.banner))
.pipe(gulp.dest(gulpConfig.dist))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(gulpConfig.dist));
});
gulp.task('watch', ['build'], function() {
gulp.watch(gulpConfig.srcFiles, ['build']);
});
gulp.task('bump', function () {
var type = gulp.env.major && 'major' ||
gulp.env.minor && 'minor' ||
gulp.env.patch && 'patch' ||
gulp.env.prerelease && 'prerelease';
gulp.src(['./bower.json', './package.json'])
.pipe(bump({type: type || 'patch'}))
.pipe(gulp.dest('./'));
});