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 todefault; 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 inpublic/ -
all files from
static/topublic/root
glaze build
Options:
-
--root <path>project root -
--cleanclean output directory before build -
--draftsinclude draft pages -
--viterun Vite build process after static build -
--vite-command <command>custom Vite build command (defaults tobuild.vite.commandornpm 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 undercontent/ -
--date <date>date/datetime parseable by Chronos -
--weight <int>optional page sort weight (lower values sort first) -
--type <type>content type name (required whencontentTypesare configured) -
--draftmark page as draft -
--indexcreate page asfolder/index.djinstead offile.dj -
--forceoverwrite existing target file -
--yesnon-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>(default127.0.0.1) -
--port <port>(default8080) -
--staticserve prebuiltpublic/ -
--buildprebuild before static serve (--staticrequired) -
--draftsinclude drafts for static mode -
--viteenable Vite integration in live mode -
--vite-host <host>Vite host (default127.0.0.1) -
--vite-port <port>Vite port (default5173) -
--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 (
--vitecannot be used with--static). -
CLI options override
glaze.neonvalues. -
{host}and{port}placeholders invite.commandare replaced at runtime. -
If your configured command cannot start (missing script/config/dependencies),
glaze serveexits 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 -
--templatesclear only the compiled Sugar template cache (tmp/cache/sugar) -
--imagesclear 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 #
-
init(once) -
serveduring development -
ccto clear caches when changing configuration -
buildfor deployment artifacts