Assets & styling

sitelo is built on Vite, so frontend JavaScript and CSS are compiled automatically. Put scripts and styles under src/ (for example src/js and src/css), link them from your HTML with root-relative URLs, and sitelo handles the rest — TypeScript, CSS imports, bundling, and minification.

Project layout

Pages and assets share src/. Folders like js/ and css/ are conventions, not requirements — sitelo cares about what your HTML references, not the folder names.

my-site/
  src/
    index.ht.js          # page — returns HTML
    css/
      styles.css         # linked from HTML → bundled
    js/
      main.js            # linked from HTML → bundled
      counter.ts         # imported by main.js → bundled too
    lib/
      posts.js           # only used in data() → never ships
  public/
    favicon.ico          # copied as-is

Reference files with root-relative paths. A <script type="module"> or <link rel="stylesheet"> is what tells sitelo to include that file in the build:

import { createCounter } from './counter.ts'

const button = document.querySelector('#count')
const next = createCounter()

button.addEventListener('click', () => {
  button.textContent = String(next())
})
@import './tokens.css';

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 2rem;
}

What Vite compiles

Need PostCSS, Sass, or other Vite plugins? Add them under vite in sitelo.config.js.

Zero JS by default

Missing-asset validation

A <script src> or stylesheet href pointing at a file that exists in neither src/ nor public/ fails the build. Prefer a warning?

export default {
  missingAssets: 'warn',
}