kobweb icon indicating copy to clipboard operation
kobweb copied to clipboard

Allow the user to generate pages at build (or export?) time

Open bitspittle opened this issue 3 years ago • 1 comments

This will need a design pass. But basically, similar to what next.js is doing with static props - for example, maybe you can query a database and generate the top-level blog indexing site dynamically from it (e.g. maybe top five most visited articles, etc.)

bitspittle avatar Jan 04 '22 17:01 bitspittle

Note that I'm doing this in my own blog site now simply by adding logic to my build.gradle file:

https://github.com/bitspittle/bitspittle.dev/blob/9da7def42a8b9a5481fe9805ac47de37e39f9576/build.gradle.kts#L142

so it's quite possible that we never need to do anything ourselves in Kobweb.

That said, I should review what I'm doing in my blog site and see if I could possibly expose some sort of API which makes doing what I'm doing easier to do.

bitspittle avatar Feb 14 '22 23:02 bitspittle

So, yeah, at this point best practice is to

  1. create a Gradle task which generates code into a folder which is the task's output
  2. add that task as a source set directory, as in jsMain { kotlin.srcDir(genStuffTask) }

bitspittle avatar Sep 27 '23 03:09 bitspittle