AppGlobals
A list of globals for this app.
You can register them in your build script, for example:
kobweb {
app {
globals.putAll(mapOf(
"author" to "bitspittle",
"version" to "v1234.5678"
))
)
}
Content copied to clipboard
And then fetch them in your own site:
AppGlobals.getValue("author") // "bitspittle"
Content copied to clipboard
Consider creating a type-safe extensions for your constants:
val AppGlobals.author get() = AppGlobals.getValue("author")
val AppGlobals.version get() = AppGlobals.getValue("version")
Content copied to clipboard
or, if you prefer, a wrapper object:
object SiteGlobals {
val author = AppGlobals.getValue("author")
val version = AppGlobals.getValue("version")
}
Content copied to clipboard