(site) Update CommonJS installation instructions

This commit is contained in:
Brandon Tilley 2014-01-15 21:31:48 -08:00
parent d873121c08
commit 2aa72ca45e

View File

@ -64,11 +64,7 @@ requirejs(['planetaryjs'], function(planetaryjs) {
CommonJS
--------
<div class='ui red raised segment'>
There is [a pull request](https://github.com/mbostock/topojson/pull/129) open on the TopoJSON project to make this process more intuitive; these instructions will be updated based on its acceptance.
</div>
First, install `browserify` and `brfs` from npm (as well as `planetary.js`, if you haven't already). Then, create your application (here referred to as `app.js`) and bundle it with browserify, running the dependencies through brfs.
First, install `browserify` from npm (as well as `planetary.js` v1.0.2+, if you haven't already). Then, create your application (here referred to as `app.js`) and bundle it with browserify.
<div class='ui raised segment'>
<div class='ui red ribbon label'>JavaScript</div>
@ -84,9 +80,18 @@ planet.draw(canvas);
<div class='ui purple ribbon label'>Shell</div>
```shell
$ npm install browserify brfs
$ ./node_modules/.bin/browserify --g brfs app.js > bundle.js
$ npm install browserify
$ ./node_modules/.bin/browserify app.js > bundle.js
```
</div>
`bundle.js` is now ready to use!
`bundle.js` is now ready to use! You may need to set the `charset` option on your script tag:
<div class='ui raised segment'>
<div class='ui blue ribbon label'>HTML</div>
```html
<script type='text/javascript' src='bundle.js' charset='utf-8'></script>
```
</div>