Usage
mdl init [dir] [options]
mdl new <dir> [options]
mdl check [app-dir|input.mdl]
mdl format [app-dir|input.mdl] [options]
mdl build [app-dir|input.mdl] [options]
mdl serve [app-dir|input.mdl] [options]
mdl spec-test [fixtures-dir] [options]
If input is omitted, MDL reads defaults from mdl.json or from the single app config under apps/*/mdl.json.
Selecting input
Commands can target a project, an app folder, or a single .mdl file.
mdl build
mdl build apps/my-mdl-site
mdl build pages/index.mdl
If multiple apps exist in one workspace, choose one explicitly:
mdl check apps/admin
mdl serve apps/marketing
Create projects
mdl init
Initialize the current folder or a target directory.
mdl init
mdl init demo-site
mdl init --app admin --port 4001
mdl new
Create a new folder and initialize it.
mdl new my-site
mdl new my-site --template blank --no-tailwind
Package scripts
Add missing npm scripts without overwriting custom scripts.
mdl init --package-scripts
npm run check
Check and format
mdl check validates syntax, config, routes, assets, labels, ARIA references, duplicate ids, and other project details.
mdl check
mdl check --json
mdl check pages/index.mdl
mdl format rewrites source files with consistent indentation. Use --check in CI.
mdl format
mdl format --check
mdl format --all apps/my-mdl-site
Build
mdl build compiles configured pages to static HTML and copies configured CSS, scripts, assets, output manifests, and source-map sidecars.
mdl build
mdl build apps/my-mdl-site
mdl build pages/index.mdl --style css/main.css --title "My Site"
mdl build pages/index.mdl --output preview.html
Use --fragment only when building one input file and you want the compiled HTML fragment rather than a full document.
Serve
mdl serve starts a local preview server with live reload.
mdl serve
mdl serve apps/my-mdl-site
mdl serve pages/index.mdl --port 5050
The server uses the configured port unless --port is provided.
Spec test
mdl spec-test compares .mdl fixtures with expected .html files. It is mainly for language development and conformance checks.
mdl spec-test
mdl spec-test fixtures/spec
mdl spec-test --update
Options
|
Option |
Commands |
Use |
|---|---|---|
|
|
|
Create or update |
|
|
|
Overwrite existing scaffold files. |
|
|
|
Create files without the init summary. |
|
|
|
Use a starter template. Currently |
|
|
|
Add missing npm |
|
|
|
Print diagnostics as JSON. |
|
|
|
Report files that need formatting. |
|
|
|
Format all configured pages. |
|
|
|
Write HTML to a specific path. |
|
|
|
Emit only the compiled HTML fragment. |
|
|
|
Add a stylesheet to full-document output. |
|
|
|
Add a JavaScript module. |
|
|
|
Add a classic script tag in the head. |
|
|
|
Set the HTML document title. |
|
|
|
Set or override the dev-server port. |
|
|
|
Rewrite expected fixture HTML files. |