# JavaScript Bundling Most applications should use {doc}`../guides/html-output` to produce a complete interactive page. Use the bundling API when you are building your own web integration and need one JavaScript file containing compatible versions of Vega, Vega-Lite, and Vega Embed. ## Get the Standard Bundle ```python from pathlib import Path import vl_convert as vlc bundle = vlc.javascript_bundle(vl_version="6.4") Path("vega-embed.js").write_text(bundle, encoding="utf-8") ``` The standard bundle exposes `vega`, `vegaLite`, and `vegaEmbed` on `window`, so browser code can use them without module imports. Select the same Vega-Lite version that the browser will render. ## Add an Application Snippet A snippet is bundled in the same module scope, so it can refer to `vega`, `vegaLite`, and `vegaEmbed`. It must not import anything outside the dependencies bundled with VlConvert. For example, save this as `snippet.js`: :::{dropdown} snippet.js :open: ```{literalinclude} /_examples/bundle-snippet.js :language: javascript ``` ::: ```python snippet = Path("snippet.js").read_text(encoding="utf-8") bundle = vlc.javascript_bundle(snippet, vl_version="6.4") Path("app-chart.js").write_text(bundle, encoding="utf-8") ``` The resulting `app-chart.js` defines the wrapper. This complete page loads the bundle and calls it with a Vega-Lite specification. Save it as `index.html` beside `app-chart.js`, then open it in a browser: :::{dropdown} index.html :open: ```{literalinclude} /_examples/bundle-demo.html :language: html ``` ::: Bundling runs build tooling on caller-supplied source. Apply authentication, body-size limits, and request budgets before exposing the server endpoints to other users.