Microsite
Do more with less JavaScript. Microsite is a smarter, performance-obsessed static site generator powered by Preact and Snowpack.
Install / Use
/learn @natemoo-re/MicrositeREADME
</div> <br /> <br /> <div align="center"> <img src="https://raw.githubusercontent.com/natemoo-re/microsite/master/.github/assets/microsite.svg?sanitize=true&v=1" alt="microsite" width="375" height="101" /> </div> <h4 align="center"> <a href="https://github.com/natemoo-re/microsite/tree/main/docs">Read the docs</a> <span> | </span> <a href="https://examples.microsite.page">See the live examples</a> <span> | </span> <a href="https://discord.gg/QMc6R8svPY">Join our Discord</a> </h4> <br /> <br />[!CAUTION] Microsite is no longer maintained. The partial hydration techniques pioneered in this project served as a precursor to Astro, which @natemoo-re co-created, and a number of other islands architecture-based frameworks like Fresh.
Consider this archive a reference implementation for islands architecture—may it inspire you to do more with less JavaScript.
microsite is a fast, opinionated static-site generator (SSG) built on top of Snowpack. It outputs extremely minimal clientside code using automatic partial hydration.
npm init microsite
Microsite is an ESM node package, so it needs to run in a Node environment which supports ESM. We support the latest version of node v12.x LTS (Erbium) — see Engines for more details.
Ensure that your project includes "type": "module" in package.json, which will allow you to use ESM in your project's node scripts.
Pages
Microsite uses the file-system to generate your static site, meaning each component in src/pages outputs a corresponding HTML file.
Page templates are .js, .jsx, or .tsx files which export a default a Preact component.
Styles
Styles are written using CSS Modules. src/global.css is, as you guessed, a global CSS file injected on every page.
Per-page/per-component styles are also inject on the correct pages. They are modules and must be named *.module.css.
Project structure
project/
├── public/ // copied to dist/
├── src/
│ ├── global/
│ │ └── index.css // included in every generated page
│ │ └── index.ts // shipped entirely to client, if present
│ ├── pages/ // fs-based routing like Next.js
│ │ └── index.tsx
└── tsconfig.json
Acknowledgments
- Markus Oberlehner,
vue-lazy-hydration - Markus Oberlehner, Building Partially Hydrated, Progressively Enhanced Static Websites with Isomorphic Preact and Eleventy
- Lukas Bombach, The case of partial hydration (with Next and Preact)
- Jason Miller and Addy Osmani, Rendering on the Web
- Poimandres,
valtiofor inspiringmicrosite/global
Related Skills
node-connect
348.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
348.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
348.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
