From 5892bd628edce482a10247bd1525048f554daeba Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 28 Jan 2015 11:51:39 +0100 Subject: [PATCH] Added `6to5ify` transform to the dependencies and docs on custom builds with browserify --- README.md | 6 +++--- package.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e239acba..7d35b959 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/package.json b/package.json index 639590de..f594c9a5 100644 --- a/package.json +++ b/package.json @@ -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",