Command Reference
The cem serve command starts a development server specifically designed for custom element development.
cem serve [flags]Command Flags
| Flag | Description |
|---|---|
--port | Port to listen on (default: 8000) |
--no-reload | Disable live reload |
--target | TypeScript/JavaScript transform target: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext (default: es2022) |
--css-transform | Glob patterns for CSS files to transform to JavaScript modules (opt-in, e.g., src/**/*.css,elements/**/*.css) |
--css-transform-exclude | Glob patterns for CSS files to exclude from transformation (e.g., demo/**/*.css) |
--watch-ignore | Glob patterns to ignore in file watcher (comma-separated, e.g., _site/**,dist/**) |
Global Flags
| Flag | Description |
|---|---|
--config | Path to config file (default: .config/cem.yaml) |
--package, -p | Deno-style package specifier (e.g., npm:@scope/package) or path to package directory |
--source-control-root-url | Canonical public source control URL for primary branch (e.g., https://github.com/user/repo/tree/main/) |
--quiet, -q | Quiet output (only warnings and errors) |
--verbose, -v | Verbose logging output |
Usage Examples
Start the dev server
cem serveStarts the server on http://localhost:8000 and opens your default browser to the element listing page.
Use a different port
cem serve --port 3000Disable live reload
cem serve --no-reloadConfigure TypeScript target
cem serve --target es2020Enable CSS module transformation
# Transform component CSS to JavaScript modules
cem serve --css-transform 'src/**/*.css' --css-transform 'elements/**/*.css'See Buildless Development for details on CSS module imports.
Ignore build directories in watcher
cem serve --watch-ignore 'dist/**,_site/**'See Also
- Getting Started - Set up your first demo
- Buildless Development - Write TypeScript and import CSS without build steps
- Knobs - Interactive testing controls
- Import Maps - Use npm packages without bundling
- Configuration - Configuration reference