# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Overview The **Video.js v10 documentation site** is an Astro-based static site generator with React islands for interactivity. The site serves documentation, blog posts, and interactive demos for the Video.js v10 library. Key architectural feature: **Multi-framework documentation** — the same content generates separate routes for different framework/style combinations (e.g., HTML + CSS, React + CSS), allowing framework-specific documentation from shared MDX sources. ## Deployment The site deploys via Netlify from two branches: | Branch | Deploys to | Content | | --- | --- | --- | | `site/v10` (production) | **videojs.org** | Stable docs matching the latest release | | `main` (branch deploy) | **main.videojs.org** | Pre-release docs (may include unreleased APIs) | **On release:** The CD workflow (`.github/workflows/cd.yml`) publishes packages to npm, then force-pushes `main`'s HEAD to `site/v10`. This keeps the production docs in sync with the latest release. **Docs hotfixes between releases:** Fix the content on `main` first, then cherry-pick to `site/v10`: ```bash git checkout site/v10 git cherry-pick git push origin site/v10 ``` The next release force-pushes `main` to `site/v10`, which already includes the cherry-picked commit (since it originated on `main`). All fixes must land on `main` first — the `site/v10` branch has branch protection that restricts direct pushes to the CD bot. **Branch deploys (main.videojs.org)** serve `X-Robots-Tag: noindex` headers to prevent search engines from indexing pre-release docs. They also render a top banner (`src/components/PrereleaseBanner.astro`) that links back to the stable site. The banner is gated by `isPrereleaseSite(Astro.site)` from `src/consts.ts` — change `PRERELEASE_URL` there if the pre-release hostname moves. ## Commands From `site/` directory: | Command | Purpose | | -------------------- | ---------------------------------------------------- | | `pnpm dev` | Start dev server at `localhost:4321` | | `pnpm build` | Build production site to `./dist/` | | `pnpm api-docs` | Regenerate API reference JSON files | | `pnpm test` | Run all tests once | | `pnpm test:watch` | Run tests in watch mode | | `pnpm test:ui` | Run Vitest with web UI | | `pnpm test:coverage` | Generate coverage report | | `pnpm astro ...` | Run Astro CLI (e.g., `pnpm astro check`) | **From monorepo root:** - `pnpm dev:site` — Start site dev server - `pnpm build:site` — Build site **Running single test file:** ```bash pnpm test sidebar.test.ts ``` ## Astro MCP Server An Astro MCP server is likely available. **Always use Astro best practices and standard patterns** for maintainability. Consult the MCP for Astro-specific guidance when working with: - Astro components and layouts - Content collections - Routing patterns - Integrations - Build optimizations Following Astro conventions ensures consistency and makes the codebase easier to maintain. ## Tailwind v4 Configuration & Gotchas This project uses **Tailwind v4** with a **custom configuration**. Standard Tailwind tokens may not be available. ### CRITICAL: Always Check globals.css First **Before using any Tailwind utility class**, read `src/styles/globals.css` to verify: - Custom color tokens (e.g., `dark-110`, `light-100`, not standard Tailwind colors) - Custom text size tokens (e.g., `text-h1`, `text-h2`, not standard `text-4xl`, `text-5xl`) - Custom tracking values - Custom font weight values - Available custom variants - And possibly more ### Custom Variant: `intent:` (NOT `hover:` or `focus-visible:`) Use the **`intent:` variant** instead of `hover:` and `focus-visible:`: ```astro ``` The `intent:` variant is defined as: ```css @custom-variant intent (&:hover, &:focus-within); ``` ### Arbitrary Tailwind: Last Resort Only **Avoid arbitrary variants like `[&:hover]` or `text-[pink]`**. Use them only as a last resort. **Prefer inline styles** when Tailwind utilities don't exist: ```astro
Content
Content
Content
``` ### Use `clsx` for Class Concatenation Always use **`clsx`** (or `cn` helper if available) for conditional classes: ```tsx import clsx from 'clsx'; ``` ### Avoiding Arbitrary Values **Prefer token-based utilities or inline styles over arbitrary values:** ```astro
Content
Content
Content
``` **For responsive/dark mode with non-token values, use CSS custom properties:** ```astro
Content
Content
``` This limits the classnames Tailwind must generate. ## Project Structure ``` site/ ├── src/ │ ├── components/ # Astro + React components │ │ └── docs/ │ │ ├── api-reference/ # API reference Astro components │ │ └── demos/ # Interactive component demos (see below) │ ├── content/ # Content collections (blog/, docs/, authors.json) │ ├── layouts/ # Page layouts (Base, Blog, Docs, Markdown) │ ├── pages/ # Route pages (file-based routing) │ ├── content/generated-component-reference/ # Generated component reference JSON (gitignored) │ ├── content/generated-util-reference/ # Generated util reference JSON (gitignored) │ ├── stores/ # Nanostores for cross-island state │ ├── styles/ # Global CSS, Tailwind imports │ ├── types/ # TypeScript type definitions │ ├── utils/ # Utilities and helpers │ │ └── docs/ # Documentation-specific utilities │ │ ├── sidebar.ts # Sidebar filtering and navigation │ │ ├── routing.ts # Docs URL building and redirects │ │ └── __tests__/ # Tests for docs utilities │ ├── consts.ts # Site-wide constants │ ├── content.config.ts # Content collection schemas │ ├── docs.config.ts # Documentation sidebar structure │ └── test-setup.ts # Vitest setup file ├── scripts/ │ └── api-docs-builder/ # Generates API reference from TypeScript ├── public/ # Static assets (served untransformed) ├── integrations/ # Custom Astro integrations │ └── llms-markdown.ts # LLM-optimized markdown generation ├── astro.config.mjs # Astro configuration ├── tsconfig.json # TypeScript config with path aliases └── vitest.config.ts # Test configuration ``` ## Interactive Demos Reference pages include live, interactive demos for each component. Demos are framework-specific (React, HTML) and style-specific (CSS). ### Directory Structure ``` src/components/docs/demos/ ├── Demo.astro # Shared shell (live preview + tabbed source code) ├── HtmlDemo.astro # Renders raw HTML via set:html └── {component}/{framework}/{style}/ ├── BasicUsage.tsx # React: component (+ .css) ├── BasicUsage.astro # HTML: Astro wrapper (renders HTML, imports CSS, bundles script) ├── BasicUsage.html # HTML: markup only, no