项目作者: natemoo-re

项目描述 :
Do more with less JavaScript. Microsite is a smarter, performance-obsessed static site generator powered by Preact and Snowpack.
高级语言: TypeScript
项目地址: git://github.com/natemoo-re/microsite.git
创建时间: 2020-10-25T16:38:23Z
项目社区:https://github.com/natemoo-re/microsite

开源协议:MIT License

下载






microsite


Read the docs
|
See the live examples
|
Join our Discord




microsite is a fast, opinionated static-site generator (SSG) built on top of Snowpack. It outputs extremely minimal clientside code using automatic partial hydration.

  1. npm init microsite

Microsite’s public API is quite stable, but I caution professional users to consider this a WIP! There are plenty of quirks and bugs (especially with dev mode) that are being ironed out until Microsite reaches a more stable v2.0.0!


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

  1. project/
  2. ├── public/ // copied to dist/
  3. ├── src/
  4. ├── global/
  5. └── index.css // included in every generated page
  6. └── index.ts // shipped entirely to client, if present
  7. ├── pages/ // fs-based routing like Next.js
  8. └── index.tsx
  9. └── tsconfig.json

Acknowledgments