MDL MDL
CLI

MDL command reference

The CLI creates projects, chooses app configs, checks and formats MDL, builds static output, runs local previews, and tests spec fixtures.

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

--app <name>

init, new

Create or update apps/<name>.

--force

init, new

Overwrite existing scaffold files.

--quiet

init, new

Create files without the init summary.

--template <name>

init, new

Use a starter template. Currently blank.

--package-scripts

init, new

Add missing npm check, build, and serve scripts.

--json

check

Print diagnostics as JSON.

--check

format

Report files that need formatting.

--all

format

Format all configured pages.

-o, --output <file>

build

Write HTML to a specific path.

--fragment

build

Emit only the compiled HTML fragment.

--style <file>

build, serve

Add a stylesheet to full-document output.

--script <file>

build, serve

Add a JavaScript module.

--head-script <file>

build, serve

Add a classic script tag in the head.

--title <title>

build, serve

Set the HTML document title.

--port <port>

init, new, serve

Set or override the dev-server port.

--update

spec-test

Rewrite expected fixture HTML files.