stevdza-san / KotlinBootstrap

Use the official Bootstrap UI components with Kotlin and Compose HTML, to build a frontend on the web.
167 stars 9 forks source link

Silk dependency required #2

Closed Nucifera8472 closed 9 months ago

Nucifera8472 commented 9 months ago

Based on the README I was under the impression that including the Silk dependencies when creating an empty kobweb project is not necessary. But after adding the first Bootstrap component, the page throws an error: IllegalStateException {message: "You can't access SilkTheme before first calling SilkApp", cause: undefined, name: 'IllegalStateException', stack: "IllegalStateException: You can't access SilkTheme … (webpack-internal:///./kotlin/website.js:1134:7)"} Apparently SilkApp { } is a requirement for Bootstrap, if this is not a bug the documentation should probably make it clearer that Silk needs to be included anyway.

bitspittle commented 9 months ago

Kobweb author here. I'll be keeping an eye on this bug in case the issue ends up being something in my own code.

Stevdza-san, can you try removing Silk dependencies from your build script and see if things still build? https://github.com/stevdza-san/KotlinBootstrap/blob/5661fe6ef7ef5d4e2a5073839fd796316847e6bf/bootstrap/build.gradle.kts#L28

As a side note, we've spent a significant chunk of the last two weeks refactoring Silk, extracting out a commonly useful core that users can use even if they don't want to use Silk widgets (this is things like ComponentStyle, Keyframe, and color mode concepts). This will land in 0.14.1 which we're hoping to push out in a few days now. This information may be irrelevant to this bug, but Stevdza-san, it's an additional option you can consider if you are using some non-widget parts of Silk in your library. However, if things build entirely without Silk, then you're done!

bitspittle commented 9 months ago

Stevdza-san, please review PR: https://github.com/stevdza-san/KotlinBootstrap/pull/3

In theory, if that works and you push out a new version, your users should not be forced to use Silk anymore.