Commands #

Glaze ships with a small CLI that covers the full workflow.

The command is exposed as a Composer binary, so the preferred invocation is glaze ....

General help #

glaze --help

If you are running from source, these work too:

php bin/glaze --help
./bin/glaze --help

init #

Create a new Glaze project scaffold.

glaze init my-site

Useful options:

  • --name
  • --title
  • --page-template
  • --description
  • --base-url
  • --base-path (for subfolder deployments, for example /blog)
  • --taxonomies
  • --preset <name|path> (scaffold preset to use; defaults to default; built-in values: default, vite; or a path to a custom preset directory)
  • --force
  • --yes (non-interactive)

Example:

glaze init my-site \
  --title "My Site" \
  --page-template "landing" \
  --description "Small notes and experiments" \
  --base-path "/blog" \
  --preset vite \
  --taxonomies tags,categories \
  --yes

Path to a custom preset directory:

glaze init my-site --preset ./my-company-preset --yes

See Scaffold presets for details on creating custom presets.

build #

Generate static output from content/ + templates/.

Build also copies:

  • non-Djot assets from content/ to matching paths in public/
  • all files from static/ to public/ root
glaze build

Options:

  • --root <path> project root
  • --clean clean output directory before build
  • --drafts include draft pages
  • --vite run Vite build process after static build
  • --vite-command <command> custom Vite build command (defaults to build.vite.command or npm run build)

Defaults for these options can be set in glaze.neon under build (clean, drafts, vite.enabled, vite.command).

Vite build example:

glaze build --vite
glaze build --vite --vite-command "pnpm build"

new #

Create a new Djot content page with frontmatter.

glaze new

Interactive prompts ask for:

  • title
  • type (only shown when contentTypes are configured)
  • date (defaults to current time)
  • create post folder (index.dj) or single file (my-title.dj)
  • draft (yes/no)

Options:

  • --root <path> project root
  • --title <title> page title (also available as positional argument)
  • --slug <slug> explicit page slug/path
  • --path <path> optional subfolder path prefix under content/
  • --date <date> date/datetime parseable by Chronos
  • --weight <int> optional page sort weight (lower values sort first)
  • --type <type> content type name (required when contentTypes are configured)
  • --draft mark page as draft
  • --index create page as folder/index.dj instead of file.dj
  • --force overwrite existing target file
  • --yes non-interactive mode

Examples:

# interactive
glaze new

# fully non-interactive
glaze new "Post title" --date "2026-02-24T14:30:00+01:00" --weight 10 --type blog --draft --yes

# create under a subfolder path
glaze new "Post title" --path "posts/2026" --yes

# smart placement from type path rule (for example `contentTypes.blog.paths[0].match: posts`)
glaze new "Post title" --type blog --yes

# when a type has multiple path rules, select one with --path (must match a `match` value)
glaze new "Post title" --type blog --path posts --yes

# create a bundle-style page with index.dj
glaze new "Post title" --path "blog" --index --yes

serve #

Run local web server for development.

glaze serve

Options:

  • --root <path>
  • --host <host> (default 127.0.0.1)
  • --port <port> (default 8080)
  • --static serve prebuilt public/
  • --build prebuild before static serve (--static required)
  • --drafts include drafts for static mode
  • --vite enable Vite integration in live mode
  • --vite-host <host> Vite host (default 127.0.0.1)
  • --vite-port <port> Vite port (default 5173)
  • --vite-command <command> custom Vite command ({host} and {port} placeholders supported)

Examples:

# live mode (templates/content)
glaze serve

# static preview after build
glaze serve --static --build

# live mode + Vite
glaze serve --vite

# live mode + custom Vite command
glaze serve --vite --vite-command "pnpm dev --host {host} --port {port}"

Using Vite #

Vite integration is available in live mode and starts your Vite dev process alongside glaze serve.

Prerequisites:

  • A valid Vite setup in your project root (for example vite.config.js/vite.config.ts).
  • A package manager script that starts Vite (for example npm run dev).
  • Template/layout code that references your Vite dev assets while developing.

For a quick start, scaffold Vite files and defaults with:

glaze init my-site --preset vite

Basic usage:

glaze serve --vite

Common customizations:

glaze serve --vite --vite-host 0.0.0.0 --vite-port 5173
glaze serve --vite --vite-command "npm run dev -- --host {host} --port {port} --strictPort"

You can also set defaults in glaze.neon:

devServer:
  vite:
    enabled: false
    host: 127.0.0.1
    port: 5173
    command: "npm run dev -- --host {host} --port {port} --strictPort"

Notes:

  • Vite integration is for live mode only (--vite cannot be used with --static).
  • CLI options override glaze.neon values.
  • {host} and {port} placeholders in vite.command are replaced at runtime.
  • If your configured command cannot start (missing script/config/dependencies), glaze serve exits with an error.

cc #

Clear the compiled Sugar template cache and/or the Glide image transformation cache.

By default both caches are cleared. Run this whenever you change Vite or template configuration and the rendered output does not reflect your changes.

glaze cc

Options:

  • --root <path> project root
  • --templates clear only the compiled Sugar template cache (tmp/cache/sugar)
  • --images clear only the Glide image cache (tmp/cache/glide)

Examples:

# clear everything
glaze cc

# clear template cache only
glaze cc --templates

# clear image cache only
glaze cc --images

Typical workflow #

  1. init (once)
  2. serve during development
  3. cc to clear caches when changing configuration
  4. build for deployment artifacts