PurpleKingdomGames / tyrian

Elm-inspired Scala UI library.
https://tyrian.indigoengine.io/
MIT License
346 stars 26 forks source link

how to achieve code completion for Tailwind CSS in Tyrian? #234

Closed weili96 closed 8 months ago

weili96 commented 9 months ago

Hello everyone, may I ask how to configure code completion for Tailwind CSS when writing code in IntelliJ IDEA using Tyrian? Currently, I'm experiencing a lack of code suggestions when entering class names in the CSS, and I'd like to know if anyone has a solution. Having code completion for Tailwind CSS would make the coding experience much more comfortable. Thank you, everyone!

If anyone has a solution, could you please send me an email to provide some guidance? I've been trying for a while but still haven't been able to achieve code completion for Tailwind CSS in Tyrian. My email address is: 739048569@qq.com. If any of you know how to resolve the above issue, I would greatly appreciate it if you could send me an email and let me know. Thank you very much.

davesmith00000 commented 9 months ago

Hi @weili96, this is a re-post from your query on Discord in case anyone stumbles upon this looking for the same answer. Again, sorry for the slow response...


Unfortunately there is no code completion for Tailwind CSS, or any other CSS framework. So to use tailwind CSS currently, you just need to use it like every other dev in the world (using Tyrian or any other web framework), which is to import the framework on to you page somehow and add the styles to your tags, like:

div(_class := "grid grid-cols-4 gap-4")(
  div("01"),
  // ...
  div("01")
)

Which in the docs, was:

<div class="grid grid-cols-4 gap-4">
  <div>01</div>
  <!-- ... -->
  <div>09</div>
</div>

In order to provide code completion, we'd need to generate the syntax as Scala code from something, publish it as a new module, and maintain it. I'd love to see modules for popular component systems and styling frameworks emerge, but it isn't my priority at the moment, so it would need a contribution from outside.