Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage without Express? #6

Open
kurtextrem opened this issue Feb 17, 2017 · 5 comments
Open

Usage without Express? #6

kurtextrem opened this issue Feb 17, 2017 · 5 comments

Comments

@kurtextrem
Copy link

Is it somehow possible to make a static build, using preact to string and then upload it to a server that doesn't run node?

@ezekielchentnik
Copy link
Owner

I like this idea and had thought of the same thing; in fact, if done right i think it could actually make this thing even faster (obviously depending on what you need for prerender in the app shell/index.html)

My plan was to create an npm script called 'prerender' or 'static' that would effectively run the root.js route and generate a static index.html file in /build.

I'd love to hear your thoughts & expectations to help me build this out.

cheers!

@kurtextrem
Copy link
Author

Sounds exactly what I had in mind 👍
Actually I've asked the author of Preact, but he didn't answer: https://twitter.com/kurtextrem/status/833217690059825152 - maybe you could push?

@developit
Copy link

Ah - sorry for.missing those tweets, I don't scan for #react tweets, only #preact ones. I think a lot of people use static-site-generator-webpack-plugin.

I actually set this up for preactjs.com but ended up switching back to just prerendering the App Shell instead of the whole app. If you want to see what the full page-by-page prerendering looked like though, it's on an ssr branch:

https://github.com/developit/preact-www/tree/ssr?files=1

@kurtextrem
Copy link
Author

Thank you Jason, that's exactly what I'm looking for. Great to hear that we're not the only one looking for such things :)

What made you switch back? Were there any drawbacks?

@developit
Copy link

The frontend dynamically fetches markdown files from a content/ directory, and shows a loading spinner while doing so. When I pre-rendered everything with seeded data, it would just immediately rip out the prerendered markdown and replace it with a spinner. I might revisit though, it's possible appending the source markdown as data to the page (via a <script> tag) would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants