-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
31 lines (27 loc) · 1.05 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
const gulp = require('gulp');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const merge = require('merge-stream');
const streamify = require('gulp-streamify');
const uglify = require('gulp-uglify');
const insert = require('gulp-insert');
const concat = require('gulp-concat');
const buffer = require('vinyl-buffer');
const header = "/* chartjs-plugin-watermark | AlbinoDrought | MIT License | https://github.com/AlbinoDrought/chartjs-plugin-watermark/blob/master/LICENSE */\n";
const outDir = "./";
function buildTask() {
const build = browserify('./src/chart.plugin.watermark.js')
.ignore('chart.js')
.bundle()
.pipe(source('chartjs-plugin-watermark.js'))
.pipe(buffer())
.pipe(insert.prepend(header))
.pipe(gulp.dest(outDir))
// min build
.pipe(streamify(uglify()))
.pipe(insert.prepend(header))
.pipe(streamify(concat('chartjs-plugin-watermark.min.js')))
.pipe(gulp.dest(outDir));
return build;
}
gulp.task('default', buildTask);