-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathGulpfile.js
31 lines (27 loc) · 839 Bytes
/
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
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
const babel = require("gulp-babel");
const browserify = require("browserify");
const gulp = require("gulp");
const rename = require("gulp-rename");
const source = require("vinyl-source-stream");
const uglify = require("gulp-uglify");
/**
* Prepares the files for browser usage
*
* - Bundle with browserify
* - Transpile with Babel
* - Minify with uglify
*/
gulp.task("build", ["bundle"], () => {
gulp
.src("./dist/dijkstra.js")
.pipe(babel())
.pipe(gulp.dest("./dist"))
.pipe(uglify())
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest("./dist"));
});
gulp.task("bundle", () => {
const b = browserify({ entries: "./libs/Graph.js" });
return b.bundle().pipe(source("dijkstra.js")).pipe(gulp.dest("./dist"));
});