Project

commandbox-ssg

A static site generator implemented as a CommandBox module — Markdown and CFML templates, layouts, pagination, and a small build pipeline, all driven from the CLI. The predecessor to boxlang-ssg, its pure-BoxLang rewrite.

CLI-native

Four commands — ssg init, ssg build, ssg watch, ssg serve — installed as an ordinary CommandBox module via box install.

Tidy output

HTML output is run through jSoup to clean up markup before it's written, based on detected content type rather than a manual flag.

Build hooks

onBuildReady(), beforeProcessCollections(), and beforeGenerate() — optional lifecycle hooks in applicationHelper.cfm for custom build logic.

Live rebuild

ssg watch monitors .cfm, .md, .css, .js, and .json files and triggers a rebuild on change.

Installation & quick start

bashbox install commandbox-ssg
bashbox
mkdir my-test-site --cd
echo "### Hello from commandbox-ssg" > index.md
ssg build

Commands

CommandWhat it does
ssg initScaffolds the current (empty) directory with the commandbox-ssg-skeleton starter app.
ssg buildRuns the full pipeline: loads ssg-config.json, includes, and global _data/, processes collections and pagination, then generates static output. Pass --showconfig to print the resolved process/config instead of building, or --verbose for extra build logging.
ssg watchWatches the current directory for .cfm/.md/.css/.js/.json changes (500ms debounce) and runs ssg build automatically.
ssg serveWrites a .htaccess and server.json for serving _site/ as clean-URL static content (if they don't already exist), then starts a CommandBox static web server.

Build lifecycle hooks

Defining these functions in applicationHelper.cfm lets you run custom code at specific points in the build, and makes any functions you define there available when rendering pages:

HookFires
onBuildReady()Once configuration has been loaded.
beforeProcessCollections()Once template data has been loaded, before collections are processed.
beforeGenerate()After collections and pagination have been processed, before static files are written.
Looking for the BoxLang version? boxlang-ssg is a from-scratch rewrite of the same idea — Markdown/.bxm templates, layouts, collections, pagination — running on the BoxLang CLI directly instead of as a CommandBox module.

Changelog highlights

Selected entries — see the repository for the complete history back to 0.0.5.

VersionChange
0.2.2Removed the skip_beautify flag in favor of content-type detection — only HTML files are run through jSoup now.
0.2.0Adopted jSoup to tidy generated output.
0.1.3Excluded _site/ by default (was breaking passthrough folders containing markdown); fixed pagination parent-template leakage into output; render now uses the template cache so excludeFromCollections works correctly.
0.1.10.1.2Added applicationHelper.cfm support and the three build lifecycle hooks above.
0.1.0build command rewritten; publishDate renamed to date (defaults to the file's last-modified time); nested global _data/**.json; new --showconfig flag.
0.0.60.0.16Windows compatibility fixes, ssg serve added, ssg watch added, automatic _includes/ exclusion.