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