Skip to content

Latest commit

 

History

827 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

domstack

npm version npm beta version Actions Status Coverage Status

DOMStack builds static websites and multi-page apps from HTML, Markdown, CSS, and JavaScript. No special syntax to learn. No editor plugins to install. No complex configuration files to learn. Just create pages in a directory, and DOMStack builds your site. It's built around Node.js and esbuild, with a bunch of features that are there when you need them and stay out of the way when you don't.

Documentation · Examples · v12 migration guide · Discord

domstack supports:

Core concepts

domstack builds pages from a src directory into a destination directory (usually public). Page URLs follow the source directory structure, creating a filesystem router without separate routing configuration.

Given this source:

src/
├── page.md                   # The home page
├── style.css                 # Styles scoped to the home page
├── client.ts                 # Browser code loaded by the home page
├── layouts/
│   ├── root.layout.ts        # The default layout for every page
│   └── blog.layout.ts        # An optional layout selected by page variables
├── globals/
│   ├── global.css            # Styles loaded by every page
│   ├── global.client.ts      # Browser code loaded by every page
│   └── global.vars.ts        # Variables available to every page and layout
├── about/
│   └── page.md               # The /about/ page
├── interactive/
│   ├── page.html             # The /interactive/ page
│   └── client.tsx            # Page-scoped browser UI written with JSX
└── blog/
    ├── page.ts               # The /blog/ page
    └── first-post/
        ├── README.md         # The /blog/first-post/ page
        └── diagram.svg       # A static asset colocated with the post

domstack produces output resembling the following (generated bundle hashes will vary):

public/
├── index.html                # Home content rendered through root.layout.ts
├── style-ABC123.css          # Bundle built from the home page's style.css
├── client-ABC123.js          # Bundle built from the home page's client.ts
├── globals/
│   ├── global-ABC123.css     # Site-wide bundle built from global.css
│   └── global.client-ABC123.js # Site-wide bundle built from global.client.ts
├── about/
│   └── index.html            # About content rendered through root.layout.ts
├── interactive/
│   ├── index.html            # Loads the bundle built from client.tsx
│   └── client-ABC123.js      # Approximate output name for the TSX bundle
└── blog/
    ├── index.html            # Blog content rendered through the selected layout
    └── first-post/
        ├── index.html        # Post content rendered through the selected layout
        └── diagram.svg       # Copied alongside the page that uses it

A page directory contains a page.md, page.html, or page.ts file. README.md may be used instead of page.md, making the source tree browsable on GitHub.

Pages can also have colocated assets:

  • style.css for page-specific styles
  • client.ts or client.tsx for page-specific browser code
  • page.vars.ts for page variables
  • *.worker.ts for web workers

Note

Wherever you see .ts being used, you can also use .js. Type checking is supported in both file types. See Supported file types for all available extensions.

Layouts wrap page content in complete HTML documents. The root layout is the default, while pages can select another layout through the layout variable. Global styles, browser code, and variables apply across the site regardless of where their files live in src.

Templates and other advanced features can generate additional output as needed. The documentation covers each convention in detail.

domstack ships with sane defaults, so you can point it at a standard Markdown-documented repository and build a website with near-zero preparation.

Installation and first build

Use Node.js 22.18+ within the 22.x release line, or Node.js 24 or newer. The v12 prerelease is published under the beta npm tag.

In a new project directory:

npm init -y
npm install --save-dev @domstack/static@beta
mkdir src

Create src/page.md:

# Hello, web

This page is built with DOMStack.

Build the site:

npx domstack

The generated page is public/index.html, rendered with the bundled default layout and stylesheet. Run npx domstack --watch to rebuild on changes, then open the local development server's URL. Use npx domstack --serve to preview a production build.

Links

License

MIT

About

Websites made with HTML, CSS & JS

Topics

Resources

Contributing

Stars

24 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages