mfbx9da4 / preact-cli-ssr

A quick demo for adding SSR to a Preact CLI app

Home Page:https://preact-cli-ssr.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preact CLI SSR Demo

A quick demo that illustrates how to add SSR to a Preact CLI app

This demo was built with preact-cli, using the default template.

It's powered by an Express server with gzip compression... nothing special there.

Because of how preact-cli produces the build directory, the server must respect static/file requests first. This also means that your build/index.html will always be served on the / request. This isn't a bad thing, it's just something to be aware of!

Important: This server behaves exactly like Preact CLI's prerendering. This means that if you (or your libraries) have references to window or document, you must wrap them in conditional statements or include a shim.

Install

$ git clone https://github.com/lukeed/preact-cli-ssr
$ npm install
$ npm run build
$ npm start

License

MIT © Luke Edwards

About

A quick demo for adding SSR to a Preact CLI app

https://preact-cli-ssr.now.sh/

License:MIT License


Languages

Language:JavaScript 74.6%Language:CSS 25.4%