Hi, I'm trying to convert our `.css` file into `St...
# compose-web
t
Hi, I'm trying to convert our
.css
file into
StyleSheet()
. Most of the stuff works, but I don't know how to correctly convert rules like this
Copy code
.classA.classB {
}
which means element that has both
.classA
and
.classB
assigned. I looked into https://github.com/JetBrains/compose-jb/blob/master/tutorials/Web/Style_Dsl/README.md but it looks like it can only be achieved in
init{}
section using string names of the classes. Any clue? Thanks
h
How exactly did you convert the css file? Manually?
t
Yes
I'm rewriting css rules into Compose format.
Ha. I found that this is compilable:
Copy code
object MyStyleSheet : StyleSheet() {
   val classA by style {}
   val classB by style {}

   init {
     classA + classB {
        property("x", "y")
     }
   }
}
So maybe it will be that simple.
👍🏻 1
👍 1
a
it can be done like this also
Copy code
object MyStyleSheet : StyleSheet() {
   init {
     ".classA.classB" {
        property("x", "y")
     }
   }
}
or
Copy code
object MyStyleSheet : StyleSheet() {
   val classA by style {}
   val classB by style {
       classA + self {
           property("x", "y")
       }
   }
}
👍🏻 1
so you can use
self
keyword for nested rules
🙏 2