# CDN

> Script tags: pinned URLs, the files, and the global Label82.

Source: https://82label.app/en/docs/cdn/

82label.app serves the files itself. Versioned URLs never change, so browsers cache them for a year. Use them on production sites.

| File | What it is |
| --- | --- |
| `/cdn/v0.2.0/82label.min.js` | For a script tag. Defines the global `Label82` and registers `<label-82>`. |
| `/cdn/v0.2.0/82label.esm.js` | An ES module to import from `<script type="module">`. |
| `/cdn/v0.2.0/82label.css` | Styles for the `<label-82>` preview frame and print button. Not needed if you only call `print()`. |
| `/cdn/latest/…` | Always the newest version, cached for an hour. For testing only. |

## Script tag

```html
<script src="https://82label.app/cdn/v0.2.0/82label.min.js"></script>
<script>
  Label82.print(template, rows);
</script>
```

## ES module

```html
<script type="module">
  import { print, renderToSVG } from 'https://82label.app/cdn/v0.2.0/82label.esm.js';
  document.querySelector('#preview').innerHTML = renderToSVG(template, rows[0]);
  document.querySelector('#print').onclick = () => print(template, rows);
</script>
```

## What the global Label82 holds

Every export of the npm package: `print`, `printers`, `agentStatus`, `loadTemplate`, `renderToSVG`, `barcodeSVG`, `qrSVG`, `layoutPages`, `FORMTEC`, `ROLL_SIZES`, `presetTemplate`, `defineLabelElement`, `VERSION` and the rest. The full list is in the [API reference](https://82label.app/en/docs/api/).

## Template JSON Schema

The JSON Schema of the template format is at [https://82label.app/schema/template.json](https://82label.app/schema/template.json) (pinned: `/schema/v0.2.0/template.json`, npm: `@82label/core/schema.json`). Point your editor at it for completion and checks.

```json
{
  "$schema": "https://82label.app/schema/template.json",
  "v": 1,
  "name": "Product barcode",
  "paper": { "kind": "roll" },
  "label": { "width": 50, "height": 30 },
  "elements": []
}
```

> You may download the files and host them yourself; the MIT license allows changes and redistribution. Usage reporting sends the domain and version once a day and never runs on intranet hosts; `<html data-82label-telemetry="off">` turns it off.
