Lit View is a VS Code extension that bundles the active Lit component, resolves its dependencies, and renders the result in a pinned side panel with optional mock-data controls.
- Preview Lit components from the explorer, editor, or command palette.
- Use a dedicated mock panel to edit inferred props and see live updates.
- Side-by-side preview stays pinned to the right and reloads when the active file changes.
- Bundled output runs in a sandboxed iframe with CSP controls; imported images are read from disk, converted to data URLs, and passed to the component automatically.
npm installnpm run compile- Launch the extension host in VS Code (F5 or
Run Extension).
Development tips:
npm run watchkeepsout/in sync while editingsrc/.npm run checkruns ESLint plus the smoke tests undertests/.
- Open a Lit
.tsfile, select the component, and runPreview Lit File(context menu or command palette). - The preview panel renders the component with bundled dependencies; the mock panel exposes props/attributes for editing.
- Switching editors refreshes the preview when the active file changes. A placeholder appears if the file is not a Lit component.
- When Context7 is configured, documentation snippets appear below the preview; otherwise the panel skips that step.
npm run packagebuilds a.vsixwithvsce.npm run releaseruns checks, packages the extension, and tags the repo.npm run bump:patch|minor|majorupdates the version with a matching commit.
npm run compile– TypeScript buildnpm run watch– incremental buildnpm run lint– ESLint oversrc/npm run test:unit–node --test tests/**/*.test.js
Issues and PRs are welcome at github.com/mdotrostami/lit.view. Keep UI strings and documentation in English.