@casoon/astro-castwright
v0.4.0
Published
Astro integration for castwright — <TerminalDemo /> and automatic Vite plugin registration.
Maintainers
Readme
@casoon/astro-castwright
The Astro integration for castwright: automatic Vite
plugin registration and a <TerminalDemo /> component.
Deliberately thin. The Vite plugin in @casoon/castwright
does the compiling and <castwright-demo> from
@casoon/castwright-player does the
playing; both work in Astro without this package. It exists so you do not have to wire them
yourself.
Install
pnpm add @casoon/astro-castwright// astro.config.mjs
import castwright from '@casoon/astro-castwright';
export default defineConfig({ integrations: [castwright()] });Use
---
import TerminalDemo from '@casoon/astro-castwright/TerminalDemo.astro';
import demo from '../demos/install.terminal.yaml';
---
<TerminalDemo demo={demo} autoplay loop />The component inlines the compiled cast as JSON (no fetch, no parser in the bundle), emits the final terminal text as the light-DOM accessibility fallback, and reserves the terminal's height so hydration does not shift the page.
Pass src="/demo.cast" instead of demo to fetch a pre-built cast at runtime.
demo and src aside, the props mirror the element's attributes: autoplay, loop,
loopDelay, poster, cols, rows, label, title, chrome, controls, class.
Licence
MIT
