Skip to content

Commit 8502123

Browse files
committed
update README:
- add modules to TOC - add info about version cdn URL - generalize path to `custom-plotly.js` - add info about cwise transform
1 parent 92cd7e4 commit 8502123

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ chart types, including 3D charts, statistical graphs, and SVG maps.
1010
## Table of contents
1111

1212
* [Quick start options](#quick-start-options)
13+
* [Modules](#modules)
1314
* [Bugs and feature requests](#bugs-and-feature-requests)
1415
* [Documentation](#documentation)
1516
* [Contributing](#contributing)
@@ -38,16 +39,19 @@ npm install plotly.js
3839
```html
3940
<!-- Latest compiled and minified plotly.js JavaScript -->
4041
<script type="text/javascript" src="https://cdn.plot.ly/plotly-latest.min.js"></script>
42+
43+
<!-- OR use a specific plotly.js release (e.g. version 1.5.0)-->
44+
<script type="text/javascript" src="https://cdn.plot.ly/plotly-1.5.0.min.js"></script>
4145
```
4246

4347
Read the [Getting started page](https://plot.ly/javascript/getting-started/) for more examples.
4448

4549
## Modules
4650

47-
If you would like to reduce the bundle size of plotly.js, you can create a "custom" bundle by using `plotly.js/lib/core`, and loading only the trace types that you need (e.g. `pie` or `choropleth`). The recommended way to do this is by creating a "bundling file":
51+
If you would like to reduce the bundle size of plotly.js, you can create a *custom* bundle by using `plotly.js/lib/core`, and loading only the trace types that you need (e.g. `pie` or `choropleth`). The recommended way to do this is by creating a *bundling file*:
4852

4953
```javascript
50-
// custom-plotly.js
54+
// in custom-plotly.js
5155
var plotlyCore = require('plotly.js/lib/core');
5256

5357
// Load in the trace types for pie, and choropleth
@@ -58,15 +62,16 @@ plotlyCore.register([
5862

5963
module.exports = customPlotly;
6064
```
65+
6166
Then elsewhere in your code:
6267

6368
```javascript
64-
var Plotly = require('./custom-plotly');
69+
var Plotly = require('./path/to/custom-plotly');
6570
```
6671

6772
#### Webpack Usage with Modules
6873

69-
Plotly.js uses a browserify transform (glslify) to transform shaders. To make the trace module system work with Webpack, you will need to install [ify-loader]() and add it to your `webpack.config.json` for your build to correctly bundle and parse `.glsl` files.
74+
Browserify [transforms](https://github.com/substack/browserify-handbook#transforms) are required to build plotly.js, namely, [glslify](https://github.com/stackgl/glslify) to transform WebGL shaders and [cwise](https://github.com/scijs/cwise) to compile component-wise array operations. To make the trace module system work with Webpack, you will need to install [ify-loader](https://github.com/hughsk/ify-loader) and add it to your `webpack.config.json` for your build to correctly bundle plotly.js files.
7075

7176
## Bugs and feature requests
7277

0 commit comments

Comments
 (0)