Skip to content

v0.18.3

Compare
Choose a tag to compare
@bitspittle bitspittle released this 06 Aug 20:47

This release is a collection of miscellaneous features and bug fixes. Enjoy!

Important

Planning to upgrade? Review instructions in the README.

Changes

Frontend

  • Modifier support for the border-image CSS property.
  • Added additional margin and padding-related CSS logical properties (like more overrides for scrollPadding, marginInline, etc.)
  • Fixed a bug where Modifier.background(color) without any other parameters would ignore the color value.
  • You can now programmatically query all routes in your site using the PageContext
    • e.g. ctx.router.routes.forEach { r -> console.log(r.path) }
  • Add new type-safe API for working with local storage and session storage (Documentation)
  • ⚠️ Legacy route support has been removed.
    • See the Notes section for more information.
  • Fixed some edge cases where underscores really confused route generation logic.
    • ⚠️ Example_Route.kt used to generate example_route and now will generate example-route.

Markdown

  • Fixed issue where putting triple quotes in code blocks would generate code that wouldn't compile.

Backend

  • API endpoints now support dynamic routes
    • e.g. @Api("articles/{article}")
    • Access the value of article in the above case using ctx.params["article"]

Gradle

  • Kobweb should now be compatible with the Gradle configuration cache.
    • Note that the Kotlin plugin itself is not until v2.0. Kobweb should have support for this version soon.

Notes

Legacy Route support removed

If you don't care that much about a bit of Kobweb history, then don't read the rest of this section. Just go into your build.gradle.kts and remove the line:

kobweb {
  app {
    // ↓↓↓↓↓↓↓
    legacyRouteRedirectStrategy.set(DISALLOW) // DELETE ME!
    // ↑↑↑↑↑↑↑
  }
}

Caution

If you have this set to WARN or ALLOW, please read here.

However, if you'd like to learn more about this, read on!

Legacy route history

In the beginning, I wrote some logic to convert a Kotlin @Page filename (Example.kt) into a URL route (/example). My initial algorithm simply lowercased everything, and while I did not realize it at the time, this made the default behavior generate names that did not conform to Google's SEO recommendations, which is to use hyphens to separate words.

In 0.16.0, we updated this! So ExampleRoute.kt would now generate /example-route and not /exampleroute.

This long overdue change which, unfortunately, could break old sites if released directly.

Therefore, we did a bunch of work to intercept routes and handle legacy formats and new formats at the same time. In other words, a site with legacy route support would work if you visited either /examperoute OR /example-route.

However, it was always the plan to remove it sooner than later. It was a lot of ugly code we had to maintain, and the issue wasn't likely to affect that many users. Therefore, we gave users 6 months to migrate any offending cases over.

And that brings us to today! Legacy routes are finally out.

In order to not break compilation, we are leaving the legacyRouteRedirectStrategy property in Gradle for now, but it doesn't do anything anymore (except print out a warning if you've set it). You have 6 months to delete this one-liner from your project...

Thanks!

We had a first time contribution from @FromWau who noticed some misformatted documentation and fixed it. These kinds of cleanups are truly appreciated! Thanks for helping keep Kobweb tidy.

And a serious shoutout to @DennisTsar who did all the hard work to fix my crappy Gradle code in order to make it configuration cache friendly.


Full Changelog: v0.18.2...v0.18.3