Install browserify globally via `[sudo] npm install -g browserify`, then create a custom bundle like:
Then create a custom bundle using browserify, like:
browserify custom.js -t babelify -o vis-custom.js -s vis
$ browserify custom.js -t babelify -o vis-custom.js -s vis
This will generate a custom bundle *vis-custom.js*, which exposes the namespace `vis` containing only `DataSet` and `Timeline`. The generated bundle can be minified with uglifyjs (installed globally with `[sudo] npm install -g uglify-js`):
This will generate a custom bundle *vis-custom.js*, which exposes the namespace `vis` containing only `DataSet` and `Timeline`. The generated bundle can be minified using uglifyjs:
uglifyjs vis-custom.js -o vis-custom.min.js
$ uglifyjs vis-custom.js -o vis-custom.min.js
The custom bundle can now be loaded like:
@ -204,11 +217,11 @@ The custom bundle can now be loaded like:
The default bundle `vis.js` is standalone and includes external dependencies such as hammer.js and moment.js. When these libraries are already loaded by the application, vis.js does not need to include these dependencies itself too. To build a custom bundle of vis.js excluding moment.js and hammer.js, run browserify in the root of the project:
browserify index.js -t babelify -o vis-custom.js -s vis -x moment -x hammerjs
$ browserify index.js -t babelify -o vis-custom.js -s vis -x moment -x hammerjs
This will generate a custom bundle *vis-custom.js*, which exposes the namespace `vis`, and has moment and hammerjs excluded. The generated bundle can be minified with uglifyjs:
uglifyjs vis-custom.js -o vis-custom.min.js
$ uglifyjs vis-custom.js -o vis-custom.min.js
The custom bundle can now be loaded as:
@ -254,12 +267,12 @@ var timeline = new Timeline(container, data, options);
Install the application dependencies via npm:
npm install vis moment
$ npm install vis moment
The application can be bundled and minified:
browserify app.js -o app-bundle.js -t babelify
uglifyjs app-bundle.js -o app-bundle.min.js
$ browserify app.js -o app-bundle.js -t babelify
$ uglifyjs app-bundle.js -o app-bundle.min.js
And loaded into a webpage:
@ -282,11 +295,11 @@ And loaded into a webpage:
To test the library, install the project dependencies once: