Skip to content

Commit

Permalink
move more specific case up
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenyou committed Jun 2, 2024
1 parent 0d9dba8 commit 7830be9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/scalawind/src/generate/templates/scalawind.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def swImpl(twStyleExpr: Expr[Tailwind])(using Quotes): Expr[String] = {
import quotes.reflect.*

def extractClassNames(term: Term): List[String] = term match {
case Apply(Select(inner, name), List(Literal(StringConstant(value)))) if name.endsWith("_") =>
extractClassNames(inner) :+ s"${name.replace("_", "-")}[$value]"
case Apply(Select(inner, name), List(styles)) =>
val classes = extractClassNames(styles).map(clx => s"$name:$clx")
extractClassNames(inner) ++ classes
case Apply(Select(inner, name), List(Literal(StringConstant(value)))) if name.endsWith("_") =>
extractClassNames(inner) :+ s"${name.replace("_", "-")}[$value]"
case Apply(Select(inner, "opacity"), List(Literal(IntConstant(value)))) =>
extractClassNames(inner).init :+ s"${extractClassNames(inner).last}/$value"
case Apply(Select(inner, "o"), List(Literal(IntConstant(value)))) =>
Expand Down

0 comments on commit 7830be9

Please sign in to comment.