diff --git a/examples/browserify/.gitignore b/examples/browserify/.gitignore deleted file mode 100644 index c2658d7d1..000000000 --- a/examples/browserify/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/examples/browserify/README.md b/examples/browserify/README.md deleted file mode 100644 index 22ddbdf38..000000000 --- a/examples/browserify/README.md +++ /dev/null @@ -1,26 +0,0 @@ -## Overview - -Example to demonstrate PDF.js library usage with Browserify. - -## Getting started - -Build project and install the example dependencies: - - $ gulp dist-install - $ cd examples/browserify - $ npm install - -To build Browserify bundles, run `gulp build`. If you are running -a web server, you can observe the build results at -http://localhost:8888/examples/browserify/index.html - -See main.js, worker.js and gulpfile.js files. Please notice that PDF.js -packaging requires packaging of the main application and PDF.js worker code, -and the `workerSrc` path shall be set to the latter file. The pdf.worker.js file -shall be excluded from the main bundle. - -Alternatives to the gulp commands (without compression) are: - - $ mkdir -p ../../build/browserify - $ node_modules/.bin/browserify main.js -u ./node_modules/pdfjs-dist/build/pdf.worker.js -o ../../build/browserify/main.bundle.js - $ node_modules/.bin/browserify worker.js -o ../../build/browserify/pdf.worker.bundle.js diff --git a/examples/browserify/gulpfile.js b/examples/browserify/gulpfile.js deleted file mode 100644 index 15661bbfd..000000000 --- a/examples/browserify/gulpfile.js +++ /dev/null @@ -1,40 +0,0 @@ -const gulp = require("gulp"); -const browserify = require("browserify"); -const streamify = require("gulp-streamify"); -const rename = require("gulp-rename"); -const uglify = require("gulp-uglify"); -const source = require("vinyl-source-stream"); - -const OUTPUT_PATH = "../../build/browserify"; -const TMP_FILE_PREFIX = "../../build/browserify_"; - -gulp.task("build-bundle", function () { - return browserify("main.js", { output: TMP_FILE_PREFIX + "main.tmp" }) - .ignore(require.resolve("pdfjs-dist/build/pdf.worker")) // Reducing size - .bundle() - .pipe(source(TMP_FILE_PREFIX + "main.tmp")) - .pipe(streamify(uglify())) - .pipe(rename("main.bundle.js")) - .pipe(gulp.dest(OUTPUT_PATH)); -}); - -gulp.task("build-worker", function () { - // We can create our own viewer (see worker.js) or use already defined one. - const workerSrc = require.resolve("pdfjs-dist/build/pdf.worker.entry"); - return browserify(workerSrc, { output: TMP_FILE_PREFIX + "worker.tmp" }) - .bundle() - .pipe(source(TMP_FILE_PREFIX + "worker.tmp")) - .pipe( - streamify( - uglify({ - compress: { - sequences: false, // Chrome has issue with the generated code if true - }, - }) - ) - ) - .pipe(rename("pdf.worker.bundle.js")) - .pipe(gulp.dest(OUTPUT_PATH)); -}); - -gulp.task("build", gulp.series("build-bundle", "build-worker")); diff --git a/examples/browserify/index.html b/examples/browserify/index.html deleted file mode 100644 index 8bd4644d6..000000000 --- a/examples/browserify/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - -
- -