aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/resources/html/gulpfile.js
blob: c456615f5b328dc42214d3e993d9850ce6696127 (plain) (blame)
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
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const tsify = require('tsify');
const sourcemaps = require('gulp-sourcemaps');

function buildJS(targetFileName, files) {
  var b = browserify({ entries: files, debug: true });
  return b
    .plugin(tsify)
    .bundle()
    .pipe(source(targetFileName))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
    .pipe(uglify().on('error', function(e) { console.log(e); }))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('.'));
}

gulp.task('build-js', function(done) {
  buildJS('quick-jump.min.js', ['./js-src/quick-jump.tsx']);
  buildJS('haddock-bundle.min.js', ['./js-src/init.ts']);
  done();
});

gulp.task('default', gulp.series('build-js'));