plentico / plenti

Static Site Generator with Go backend and Svelte frontend

Home Page:https://plenti.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Component cache

jimafisk opened this issue · comments

It might make sense to add a component cache for generated dom and ssr Svelte components so these do not need to get generate on every build. Loading the compiler into V8 and creating these components is by far the slowest process of the build. This is necessary during development of an app, but once the site is live, the edits through the git-cms are all JSON and media assets.

We should add a command like plenti build --cache=true that will create a directory structure like:

cache
 └─ dom
   └─ layouts/gloabl/html.js
   └─ layouts/gloabl/head.js
   └─ layouts/content/_index.js
 └─ ssr
   └─ layouts/gloabl/html.js
   └─ layouts/gloabl/head.js
   └─ layouts/content/_index.js

Then on future builds if the cache folder exists in the project root, the client build step that compiles the Svelte components will be skipped completely. If you want to regenerate components, just delete the cache folder or plenti build --cache=false