-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does this work with commonMain? #20
Comments
What I want to do:
|
No. The plugin only works with test resources. There are some reasons for this, such as resources not being packaged with binaries in most cases, or Karma only being available in testing. What is your use case? |
Closing for now, but happy to discuss if there's follow-up. :) |
I have a use case in which I need to read an HTML file in CommonMain and load it by WebView on each platform. Does this library support reading resources under the commonMain folder? |
It does not. I'm afraid the way resources are made available to some platforms is not suitable for any environment that's not a test environment. For example, it leverages Karma in JS, which is the test runner. It also leverages resources in JVM platforms, which includes Android, where they are discouraged. Theoretically, it could be made to work in It's not a scalable solution, but for a single HTML file, consider inlining it in a multi-line string. You can even automate generating that Kotlin file based on the original HTML file at build time. |
Thanks for your instruction! Could you provide more information on how to generate a Kotlin file based on an HTML file at build time? |
You can create a Gradle task that, during build time, reads the file, and uses it to generate a Kotlin file. I'm sure you'll find some examples online! |
The README shows this snippet with commonTest, but I have a use-case for commonMain. Is it expected that this library will work there, too?
The text was updated successfully, but these errors were encountered: