Master every command, flag, and workflow tool OrbLayout provides — from scaffolding to live-reload development to production builds.
OrbLayout ships with a single CLI binary: orb. Every command starts with it.
orb init # Scaffold a new project
orb build # Compile .orb → HTML
orb build --minify # Compile + minify HTML/CSS/JS
orb dev # Dev server with live reload
orb dev --port 8080# Custom port
orb clean # Remove dist/ folder
orb help # Show help
orb version # Show version (v1.2.0)
| Command | What It Does | Flags |
|---|---|---|
init | Creates project folders + starter files | — |
build | Compiles all pages to dist/ | --minify |
dev | Starts dev server + watches files | --port <num> |
clean | Empties the dist/ directory | — |
help | Displays all commands & options | — |
version | Prints the installed version | — |
Run orb init in an empty directory to generate the full project structure.
mkdir my-site && cd my-site
npx orblayout init
╔═══════════════════════════════════════╗
║ ◉ O r b L a y o u t v1.2.0 ║
║ Static Site Builder ║
╚═══════════════════════════════════════╝
Scaffolding new OrbLayout project...
✓ Created pages/
✓ Created components/
✓ Created layouts/
✓ Created assets/
✓ Created orb.config.json
✓ Created layouts/main.layout
✓ Created components/header.orb
✓ Created components/footer.orb
✓ Created pages/index.orb
──────────────────────────────────
Project scaffolded! Run:
orb build — Build static HTML
orb dev — Start dev server
Safe to run again. orb init only creates files that don't already exist — it will never overwrite your work.
Compiles every .orb file in pages/ into static HTML in dist/.
orb build
Building pages...
✓ index.orb → index.html
✓ about.orb → about.html
✓ blog/post-1.orb → blog/post-1.html
✓ Assets copied
──────────────────────────────────
Done! 3 page(s) compiled in 24ms
Output: dist/
Here's exactly what happens during a build:
dist/ folder (clean start).orb files in pages/--minify flag)dist/assets/ → dist/assets/Produces smaller HTML for production:
orb build --minify
# What minification does:
# - Removes whitespace
# - Removes HTML comments
# - Removes redundant attributes
# - Minifies inline CSS & JS
Nested folders in pages/ create matching directories in output:
pages/
├── index.orb
├── about.orb
└── blog/
├── post-1.orb
└── post-2.orb
dist/
├── index.html
├── about.html
└── blog/
├── post-1.html
└── post-2.html
Start a local server that watches your files and auto-refreshes the browser when you save.
orb dev
# Or with custom port:
orb dev --port 8080
Building...
✓ index.orb → index.html
✓ Assets copied
🌐 OrbLayout dev server running at http://localhost:3000
Watching for changes...
OrbLayout uses SSE (Server-Sent Events) — no WebSocket dependency needed.
pages/, components/, layouts/, and assets/"reload" to all connected browserswindow.location.reload()| Feature | Details |
|---|---|
| Static files | Served from dist/ |
| Clean URLs | /about → about.html |
| Directory indexes | /blog/ → blog/index.html |
| MIME types | HTML, CSS, JS, JSON, PNG, JPG, SVG, fonts |
| SSE endpoint | /__orb_reload |
| 404 page | Built-in styled dark-theme 404 |
Press Ctrl+C to stop the server gracefully.
Removes everything inside dist/. Useful before a fresh production build.
orb clean
# Then rebuild from scratch:
orb build --minify
Every OrbLayout project reads its settings from orb.config.json in the project root.
{
"pagesDir": "pages",
"componentsDir": "components",
"layoutsDir": "layouts",
"outputDir": "dist",
"assetsDir": "assets",
"minify": false,
"pretty": true
}
| Key | Default | Description |
|---|---|---|
pagesDir | "pages" | Directory containing your .orb source files |
componentsDir | "components" | Directory for reusable component files |
layoutsDir | "layouts" | Directory for .layout templates |
outputDir | "dist" | Where compiled HTML is written |
assetsDir | "assets" | Static files copied to output as-is |
minify | false | Enable HTML minification (also via --minify flag) |
pretty | true | Pretty-print output HTML |
You can rename any directory:
{
"pagesDir": "src/views",
"componentsDir": "src/ui",
"layoutsDir": "src/templates",
"outputDir": "build",
"assetsDir": "public",
"minify": true
}
If orb.config.json doesn't exist, OrbLayout uses the defaults. You only need to include keys you want to change.
Add OrbLayout commands to your package.json for convenience:
{
"name": "my-site",
"scripts": {
"dev": "orb dev",
"build": "orb build",
"prod": "orb clean && orb build --minify",
"clean": "orb clean"
}
}
npm run dev # Start dev server
npm run build # Build site
npm run prod # Clean + minified production build
Use OrbLayout from your own Node.js scripts — perfect for custom build pipelines, CI/CD, and automation.
const { loadConfig, OrbCompiler, OrbBuilder, OrbDevServer } = require("orblayout");
// Load config from current directory
const config = loadConfig(__dirname);
// ── Option 1: Full build ──
const builder = new OrbBuilder(config);
const result = await builder.build();
console.log(`Built ${result.pages} pages in ${result.time}ms`);
// ── Option 2: Compile a single page ──
const compiler = new OrbCompiler(config);
const html = compiler.compilePage("pages/index.orb");
// ── Option 3: Start dev server ──
const server = new OrbDevServer(config);
await server.start(3000);
const { loadConfig, OrbCompiler } = require("orblayout");
const config = loadConfig(__dirname);
const compiler = new OrbCompiler(config);
// Register your own filter
compiler.registerFilter("shout", (value) => {
return value.toUpperCase() + "!!!";
});
compiler.registerFilter("dollars", (value) => {
return "$" + Number(value).toFixed(2);
});
// Now {{ greeting | shout }} → "HELLO!!!"
// And {{ price | dollars }} → "$9.99"
| Export | Type | Description |
|---|---|---|
loadConfig(rootDir) | Function | Reads orb.config.json and returns resolved config object |
OrbCompiler | Class | Core compiler — .compilePage(path), .registerFilter(name, fn) |
OrbBuilder | Class | Build orchestrator — .build() discovers & compiles all pages |
OrbDevServer | Class | Dev server — .start(port), .stop() |
You should now be able to:
init, build, dev, clean, help, version--minifyorb.config.json with custom directoriescompiler.registerFilter()