From 0394c14ee729f4762f2b2b540d3214d30c9f0262 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Tue, 11 Mar 2014 18:16:44 -0300 Subject: [PATCH] update README for browser version --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++---- package.json | 2 +- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b65dc77..ca5c591 100644 --- a/README.md +++ b/README.md @@ -257,13 +257,49 @@ Bitcore is still under heavy development and not quite ready for "drop-in" produ Bitcore needs some developer love. Please send pull requests for bug fixes, code optimization, and ideas for improvement. #Browser support -Work to enable Bitcore for use in the browser is ongoing. To build bitcore for the browser: +## Building the browser bundle +To build bitcore full bundle for the browser: +(this is automatically executed after you run `npm install`) + +``` +node browser/browserify.js -a +``` +This will generate a `browser/bundle.js` file which you can include +in your HTML to use bitcore in the browser. + +## + +##Example browser usage + +From example/simple.html ``` -npm install -g grunt-cli -grunt shell + + + + + + + ``` -You can check a usage example at examples/example.html +You can check a more complex usage example at examples/example.html + +## Generating a customized browser bundle +To generate a customized bitcore bundle, you can specify +which submodules you want to include in it with the -s option: + +``` +node browser/browserify.js -s Transaction,Address +``` +This will generate a `browser/bundle.js` containing only the Transaction + and Address class, with all their dependencies. +Use this option if you are not using the whole bitcore library, to optimize +the bundle size, script loading time, and general resource usage. #License diff --git a/package.json b/package.json index a66c77f..3ba6ec2 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ }, "scripts": { "test": "mocha test -R spec", - "postinstall": "grunt shell" + "postinstall": "node ./browser/browserify.js -a" }, "dependencies": { "soop": "git://github.com/bitpay/soop.git",