Skip to content

Installation

Install the package and its peer dependency:

Terminal window
npm install @warrenbuckley/audio-visualizer lit

lit is a peerDependency. If your project already uses Lit, only the first install is needed. The main dist/audio-visualizer.js bundle keeps Lit external so you and the rest of your app share a single copy.


The package ships a standalone build (audio-visualizer.standalone.js) where Lit is bundled inside (~35 kB / ~11 kB gzip). Drop it into any HTML page — no npm, no bundler, no import map.

<script type="module"
src="https://cdn.jsdelivr.net/npm/@warrenbuckley/audio-visualizer/dist/audio-visualizer.standalone.js">
</script>
<script type="module"
src="https://unpkg.com/@warrenbuckley/audio-visualizer/dist/audio-visualizer.standalone.js">
</script>

esm.sh rewrites bare specifiers at the CDN layer, so you can use the lighter main build (Lit external, ~10 kB) without installing anything:

<script type="module">
import 'https://esm.sh/@warrenbuckley/audio-visualizer';
</script>

An import map tells the browser how to resolve bare specifiers, letting you use the main build while sharing one copy of Lit across all components on the page:

<script type="importmap">
{
"imports": {
"lit": "https://esm.sh/lit@3",
"lit/": "https://esm.sh/lit@3/",
"@warrenbuckley/audio-visualizer": "https://esm.sh/@warrenbuckley/audio-visualizer"
}
}
</script>
<script type="module">
import '@warrenbuckley/audio-visualizer';
</script>

The "lit/" entry is a path-prefix mapping that covers all Lit sub-paths in one line. Generate a full version-pinned map (with optional SRI hashes) at generator.jspm.io.