Skip to content
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

[Question] multi platform support #2

Open
christian-draeger opened this issue Dec 6, 2024 · 4 comments · May be fixed by #3
Open

[Question] multi platform support #2

christian-draeger opened this issue Dec 6, 2024 · 4 comments · May be fixed by #3

Comments

@christian-draeger
Copy link

christian-draeger commented Dec 6, 2024

Hi,
first of all thx for the great project.
i am currently experimenting with building fullstack webapps in kotlin.

since i usually use typescript, nextjs, zod, trpc and tailwind to do so, kotlinwind would be the perfect and my last missing piece to archive a simular workflow in kotlin.
i am currently building an example project in my spare time to try out a simular scenario in a kotlin multiplatform project using ktor server, krpc, kotlin js react wrapper, akkurate and kotlinwind: https://github.com/christian-draeger/Korpus

To style server side rendered markup with kotlin html dsl on the jvm server side i already added kotlinwind.
To style components in the kotlinjs frontend i am currently using emotion kotlin wrapper as a jss/styled-components like approach since (currently) kotlinwind only works on the kotlinjvm server side and emotion only works on the kotlinjs frontend side, none of the approaches supports usage in common source sets to be used across multiple target platforms.
The problem i see with this setup (same as on fullstack typesscript project with e.g. emotion and nextjs) is that i can not reuse components everywhere as i want.

coming from nextjs this is one of the big adavantages of tailwind - it can just be used seamlessly client and server side.

Long story short - enabling same capabilities for kotlinwind would be a huge USP for such fullstack web setups.
As far as i can see kotlinwind is pure kotlin code without any external dependencies. Thereby it should be just releasable for jvm, js and common to make it usable everywhere and thereby enable fluent code sharing of styled ui components.

Do you have any plans to do so? =)

@allangomes
Copy link
Owner

Yes, of course.

I have plans to make it multiplatform soon. I believe it will be perfect to integrate with your project and build a very interesting ecosystem together.

The first step will indeed be this: making it multiplatform and after creating a module for JetPack Compose.

@christian-draeger
Copy link
Author

christian-draeger commented Dec 28, 2024

i was able to migrate the project to use kmp plugin instead of jvm and thereby build kotlin common, jvm and js artifacts.
there is still some issue with running the tests against js source set - i will try to figure out what the problem is.
adding other targets like android, ios, etc should be (hopefully) relatively straight forward after this change.

https://github.com/christian-draeger/kotlinwind.css/tree/kmp

i am going to try figuring out how to make the js build work completely - would you be open for a pull reuest if i get it working?

EDIT: it's actually not to bad - 97% successful tests. The few tests failing are because of errors like:
bottom_fraction[js, node] AssertionError: Expected <bottom: 25.0%>, actual <bottom: 25%>.

@allangomes
Copy link
Owner

Great work man! 🎉🚀

I am currently working with your branch locally, running some tests and checking for any issues on the JVM side. Right off the bat, I can see that you've done an excellent job.

When you feel comfortable, you can open a PR here, and I will approve it without any problems.

@christian-draeger christian-draeger linked a pull request Jan 10, 2025 that will close this issue
@christian-draeger
Copy link
Author

PR open :)
I'm looking forward to the release 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants