https://kotlinlang.org logo
#javascript
Title
# javascript
e

Edoardo Luppi

10/01/2023, 10:25 PM
I've just tested out a very simple React app module. Overall it feels good with typesafe HTML and CSS. With 1.9.20-Beta2, I can't seem to get auto/live-reload to work with
jsBrowserDevelopmentRun
tho. Is this a known issue?
t

turansky

10/01/2023, 10:45 PM
Is it fine with
1.9.10
?
Do you use
-t
flag?
e

Edoardo Luppi

10/02/2023, 7:01 AM
@turansky with 1.9.10 I just use
gradle jsBrowserDevelopmentRun
. It seems Webpack handles reloading? I can see it printing stuff on the console. With 1.9.20 it doesn't work anymore, and I'm forced to use
-t
Although thinking about it now, Webpack can't really reload changes by itself. It needs a kotlinc pass first, so the
-t
makes sense to be there always
@turansky one thing the kotlin-wrappers readme doesn't mention is the various ways CSS can be used. What I've seen is only "inline" CSS via DSL, but what if I want to include a
.css
or
module.css
file, to keep styles separate? Is that possible using kotlin-react?
t

turansky

10/02/2023, 9:26 AM
It's possible via
import
function, but with zero IDE support
e

Edoardo Luppi

10/02/2023, 9:41 AM
With this one? Zero IDE support seems what you'd have with a TS React project too, so no big deal
t

turansky

10/02/2023, 9:42 AM
With this one?
Yes
Zero IDE support seems what you'd have with a TS React project too, so no big deal
You can configure plugins, which will help you with class names autocomplete
e

Edoardo Luppi

10/02/2023, 9:45 AM
That's something I can have a look at. Do you have a reference plugin in mind? Should be hard to adapt it and offer autocompletion based on Kotlin PSI elements
t

turansky

10/02/2023, 9:46 AM
PSI looks like redundant, you can generate
.kt
files with class names instead
e

Edoardo Luppi

10/02/2023, 9:47 AM
Seems too elaborate to me. With an IJ plugin it is fairly straightforward to add reference resolution (and thus autocompletion)
Maybe with the new K2 compiler integration for IDEA, a compiler plugin to generate fields on the fly is a better idea tho
t

turansky

10/02/2023, 9:50 AM
File generation works fine right now
👀 1
e

Edoardo Luppi

10/02/2023, 10:36 AM
@turansky another approach could be to have global/shared CSS styles in Kotlin code, with kotlin-css or kotlin-emotion. Would that be possible?
t

turansky

10/02/2023, 11:07 PM
Example required