Using in HAML templates
See original GitHub issueHello!
I just migrated my Rails app to vite.js. I would like to integrate windicss. I have followed the docs and it kind of works.
I can use @apply in my stylesheets and I can use windi classes in HTML templates. However. I have mixed results in HAML templates - which I use in all my projects. I have added .haml extension to confing, so templates are scanned.
Apparently there are some issues with HAML syntax. I learned that using hash syntax for classes works:
%div{:class => 'my-nice-class other-class'}
But mixing with HAML dot notation (very common) causes troubles:
%div.my-nice-class.other-nice-class
The strange thing is, that sometimes it works, sometimes not. I am trying to find out what could be the source of troubles… I though it was the dashes in class-names, but probably it is not…
I am using normal vite processing from vite_rails gem.
Is somebody using HAML with Windi? I fould some haml references in docs/examples, but technically it is not confirmed anywhere that it should work 😉
thanks in advance for any hints! Jakub
Issue Analytics
- State:
- Created 2 years ago
- Comments:5

Top Related StackOverflow Question
Thanks @cmwoodal ;
Your extractor also works with slim
Iterating on your work, I need to match
top-1/2I’ve run into the same issue – the scanner doesn’t recognize the dot notation classes nor the HAML % notation tags. Fortunately windicss provides the ability to provide custom extractor functions that can be used to provide special handling. For this situation I was able to provide a special extractor function specifically for HAML files
The regexes for both classes and tags have been tested to return a concise list of matches:
classes:
tags:
Hope this is helpful for anyone else who might run into this situation.