Browse Source

Added `6to5ify` transform to the dependencies and docs on custom builds with browserify

flowchartTest
jos 9 years ago
parent
commit
5892bd628e
2 changed files with 4 additions and 3 deletions
  1. +3
    -3
      README.md
  2. +1
    -0
      package.json

+ 3
- 3
README.md View File

@ -159,7 +159,7 @@ The source code of vis.js consists of commonjs modules, which makes it possible
Before you can do a build:
- Install node.js, npm, and browserify on your system.
- Install node.js, npm, browserify, and uglify-js on your system.
- Download or clone the vis.js project.
- Install the dependencies of vis.js by running `npm install` in the root of the project.
@ -175,7 +175,7 @@ exports.Timeline = require('./lib/timeline/Timeline');
Install browserify globally via `[sudo] npm install -g browserify`, then create a custom bundle like:
browserify custom.js -o vis-custom.js -s vis
browserify custom.js -t 6to5ify -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`):
@ -200,7 +200,7 @@ 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 -o vis-custom.js -s vis -x moment -x hammerjs
browserify index.js -t 6to5ify -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:

+ 1
- 0
package.json View File

@ -36,6 +36,7 @@
"devDependencies": {
"6to5": "^2.12.2",
"6to5-loader": "^2.0.0",
"6to5ify": "^4.0.0",
"clean-css": "latest",
"gulp": "^3.8.5",
"gulp-concat": "^2.2.0",

Loading…
Cancel
Save