CLI Commands

Complete reference for all available commands

staticblocks init

staticblocks init <project-name>

# Example
staticblocks init my-website

Create a new StaticBlocks project with interactive prompts for CSS framework, icons, and i18n

staticblocks generate

staticblocks generate <type> <name> [options]
# Alias: staticblocks g

# Generate a block
staticblocks generate block hero
staticblocks generate block slider --with-js --with-css

# Generate a template
staticblocks generate template blog

# Generate a page
staticblocks generate page about

Generate blocks, templates, or pages. Use --with-js and --with-css flags for blocks

staticblocks build

staticblocks build [options]

# Basic build
staticblocks build

# Verbose output
staticblocks build --verbose

# With minification
staticblocks build --minify

Build the project for production. Generates HTML, bundles JS, processes CSS, and creates SEO files

staticblocks dev

staticblocks dev [options]

# Start dev server (default port 3000)
staticblocks dev

# Custom port
staticblocks dev --port 8080

# Auto-open browser
staticblocks dev --open

Start development server with hot reload and file watching

staticblocks validate

staticblocks validate [type]

# Validate everything
staticblocks validate

# Validate specific type
staticblocks validate pages
staticblocks validate locales
staticblocks validate templates
staticblocks validate blocks

Validate project configuration and files. Checks for missing files, invalid syntax, and broken references

staticblocks add

staticblocks add <type> <name>

# Add a new locale
staticblocks add locale fr

# Add a new script
staticblocks add script analytics

Add new locales or scripts to your project