Daily workflow #

The day-to-day loop in Glaze is simple: write content, check it locally, ship it. This page covers the practical side — how to run the dev server, create pages, manage drafts, and generate the final build.

Project structure #

A Glaze project has a straightforward layout:

my-site/
  content/       Djot source files (.dj)
  static/        Public assets — copied verbatim to public/ during build
  templates/     Sugar PHP templates (.sugar.php)
  public/        Generated static output (do not commit)
  tmp/cache/     Template render cache (do not commit)
  glaze.neon     Project configuration

Only content/, static/, templates/, and glaze.neon are yours to edit. public/ is generated output and tmp/ is an internal cache — neither should be committed to version control.

Running the dev server #

glaze serve
glaze serve --vite

Open http://127.0.0.1:8080. Pages render on each request — edit a .dj file or a template, refresh the browser, and you see the change. No rebuild step, no cache to flush.

Glaze starts the PHP dev server and the Vite dev server side-by-side. Sugar’s s:vite directive in your templates renders the correct HMR tags automatically.

Creating new pages #

glaze new
glaze new "My post title" --yes

Glaze prompts for a title, content type (if you have any configured), date, draft status, and whether to create a single file or an index.dj bundle. Answer or hit enter to accept the defaults.

With a content type:

glaze new "Release 2.0" --type blog --yes

Create a bundle-style page with an index.dj inside a subfolder:

glaze new "Project notes" --path notes --index --yes

Full option reference: Commands.

Drafts #

Mark a page as a draft in frontmatter to exclude it from builds:

---
title: Work in progress
draft: true
---

Behavior by command:

  • glaze serve — always includes drafts; you always see your work in progress locally
  • glaze build — excludes drafts by default; they never ship accidentally
  • glaze build --drafts — include drafts in the build output if you need to

Building #

Generate static output with:

glaze build

Output lands in public/. Glaze cleans the output directory before writing by default. To skip cleaning (useful for incremental builds or debugging):

glaze build --noclean

What happens during a build:

  1. All non-draft .dj files in content/ are rendered to HTML in public/
  2. Non-Djot files inside content/ are copied to matching paths in public/
  3. Everything in static/ is copied verbatim to public/
  4. Glide image transforms are baked to static files under public/_glide/

To include the Vite production build:

glaze build --vite

Previewing the built output #

Before deploying, preview the generated public/ through a real server rather than opening HTML files directly:

glaze serve --static --build

The --build flag triggers a fresh build first. --static then serves public/ as-is, so you see exactly what a visitor would see.

Images #

Glaze integrates League Glide for on-demand image transforms. Apply resize parameters inline in content:

![Hero](images/cover.jpg?w=1200&h=500&fit=crop)

Or define named presets in glaze.neon and reference them with ?p=:

![Thumb](images/photo.jpg?p=thumb)

In glaze serve, transforms run on demand and are cached under tmp/cache/glide/. In glaze build, all discovered image URLs are baked to static files under public/_glide/.

Full details: Glide images.

Syntax highlighting #

Fenced code blocks are highlighted automatically using Phiki. Configure the theme and gutter display in glaze.neon:

djot:
  codeHighlighting:
    enabled: true
    theme: github-dark
    themes:
      dark: github-dark
      light: github-light
    withGutter: true

Phiki ships with many themes. See the Phiki README for the full list. Use theme for a single theme, or themes when you want light/dark switching via CSS.