sapper
sapper copied to clipboard
sapper incremental export - can export update only one route, not all the contents of site?
In case of blog or news website we need to update collections of dynamic routes, but not to render each item on update as sapper export
command does .
Is there a way to export just one route, not the whole site? similar to https://nuxtjs.org/api/nuxt-render-route.
The ideal workflow is:
- server receives a webhook - for example, a new article is added
- and triggers rendering of
routes/articles/fresh-article-slug
, then adds it to thousands of previously generated articles as__sapper__/export/articles/fresh-article-slug
without affecting the rest.
Can I do it with Sapper?
As of now, the only solution I see is to have a temporary export destination, where to put only the updated article. Next dully copy the exported updated one to its fellows in a real export folder. Definetly this solution is terrible. How to do a proper update of static website (if possible)?
I think Sapper currently uses timestamps in filenames. That makes incremental builds challenging.
Thank you! I see... After looking at Gatsby and Gridsome it is surprising that so few static site generators support incremental builds.
I would appreciate any comments on the idea to copy&past one exported item from "temporary" export folder to a "general" export folder. May it work around the problem?
This is a great idea to consider, especially for larger projects that take a while to export.
Where do timestamps come in during the build?
I feel like this would be as easy as sapper export --entry /url/to/updated/route --no-crawl
with the idea only that entry point would be crawled, but the code to go to multiple links would not run.
Maybe I am over simplifying this?
It appears that during export hashes are no longer added based on #670 - is that right @Conduitry .
@NadiaRom @s0kil - we added #856 to allow building a single page. We will be opening a PR soon for filtering routes as well. This PR will only do the entry point. The next one will do routes that match a regex condition allow you to split your builds.
@Conduitry - I'm wondering if there's any updates on this?
My use case is that I want to generate a single page only export, but let the rest be. My sitemap on my site is now into the ~35k+ links and has to make API requests to generate. I'd like that to generate once /day or on deploy, or whatever.
I was hoping I could just do
npx sapper export --entry "sitemap"
which would call my sitemap and generate it. However, it generates the entire site, which is unnecessary as it's stateful and is rendered by express.
I wasn't able to find a way to generate a singular page, and it looks like this was the closest idea to doing that.
Thanks!