varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.46k stars 65 forks source link

Remove magical "default" rule with templates #189

Closed bitspittle closed 1 year ago

bitspittle commented 1 year ago

Currently, a template under the folder "default" is treated magically (the name "default" is stripped, so "site/default" becomes just "site", and you can have "site/default" and "site/empty" live side by side)

However, we can handle this in other ways instead...

1) We already delete templates that are located underneath a project, so we can just create site and put site/empty inside of it. 2) We can add a field to .kobweb-template.yaml, so that we still create site/default but it reads from the template file the name site and uses that instead. No more magic default value.

1 has an advantage that it is backwards compatible. Old CLIs should work just fine. And we can remove all our "default" suffix logic in the code.

2 is clean because it supports sibling templates while still documenting what was previously magic. However, this now requires kobweb create to walk through all projects to find one with a matching name.


I was originally trying to avoid nesting, but it might happen anyway. For example, now I'm considering creating a template called site/empty/multimodule

bitspittle commented 1 year ago

I ended up doing option 2