Skip to content

Improving PlotlyViaWindowModule docs #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 14, 2019
Merged

Improving PlotlyViaWindowModule docs #40

merged 3 commits into from
Feb 14, 2019

Conversation

andrefarzat
Copy link
Collaborator

@alwaysprep do you mind reviewing this?
Closes #36

@andrefarzat andrefarzat self-assigned this Feb 3, 2019
@@ -172,7 +174,33 @@ export class AppModule { }

### Plotly Via Window Module

If you want to use a [different precompiled bundle](https://github.com/plotly/plotly.js/blob/master/dist/README.md#partial-bundles) or if you wish to [assemble you own customized bundle](https://github.com/plotly/plotly.js#modules), you can use `PlotlyViaWindowModule` to force the use of `window.Plotly` object. You can add the script via tag `<script>` direct on your code, or add it as a [global script on angular.json](https://github.com/angular/angular-cli/wiki/stories-global-scripts#global-scripts).
`plotly.js` can be added as a [global script on angular.json](https://github.com/angular/angular-cli/wiki/stories-global-scripts#global-scripts) to avoid it beingb bundled into the final project's code. To make this happen, you must first add `plotly.js` path into `angular.json` file as shown below:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: beingb

@ryanjackman
Copy link

I wasn't the person who requested this but I found these changes helpful. I was able to switch to a smaller bundle of plotly.js.

LGTM

@alwaysprep
Copy link

Thanks @andrefarzat it is more clear now. As @ryanjackman point out there is a typo there, other than that it is great.
I have one more question, as far as I understand tree shaking does not work on this situation since plotly.js is put on vendor.js no matter what. Am I wrong?

@andrefarzat
Copy link
Collaborator Author

andrefarzat commented Feb 14, 2019

@alwaysprep exactly. As far as I understood, the tree-sharking works only on the code which passes through the ivy compiler. Although, you can still create your own plotly.js bundle to optimize the size

@andrefarzat andrefarzat merged commit 71753d1 into master Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants