Static Site Generation (SSG)

Nixi supports building static HTML sites from your Lua routes. Generate deployable HTML/CSS for Vercel, Cloudflare, Netlify, or any static host.

Configuration

Create nixi.lua in project root:

return {
    name = "My Static Site",
    theme = {
        name = "tokyoNight",
        colors = {
            background = "#1a1b26",
            primary = "#7aa2f7",
        },
    },
    build = {
        output = "dist",
        skipRoutes = {"/api/*"},
    },
}

Build Commands

# Via CLI
nixi build

# Custom output
nixi build dist

# Clean build
nixi build -c

# Direct
luajit src/nixi/ssg.lua

Output Structure

dist/
├── index.html           # /
├── about/index.html     # /about
├── css/style.css       # Generated CSS
├── public/             # Copied from public/
└── 404.html            # Custom 404

Dynamic Routes

For routes with parameters like /users/:id:

-- nixi.lua
build = {
    dynamicValues = {
        ["/users/:id"] = {
            {id = "1"},
            {id = "2"},
            {id = "3"},
        },
    },
}

CSS Support

CSS is automatically extracted from Nixi.style:

Nixi.style.variable("primary", "#7aa2f7")
Nixi.style.rule("body", {backgroundColor = "#1a1b26"})

Output to dist/css/style.css

Skip Routes

build = {
    skipRoutes = {
        "/api/*",
        "/_hx*",
        "/webhook/*",
    },
}

Built with ❤️ by ijadux2