railwind
railwind copied to clipboard
[question] - are @apply directives supported ?
Hey!
Trying to port a node CLI I have to rust and came across your project and seems to be the only one currently maintained and working.
Unfortunately my use case is with the @apply
directive and that does not seem to be supported correct?
If not I can also try to pitch in to add that if given some direction on where to make changes
Hi! I haven't yet seen such a use case but I think I have a function that parses a string to classes. But I think I haven't yet added that into the CLI.
Also it could be easy to add a seperate function that searches for the lines that contain '@apply'.
Okay I added support for files that are not HTML. Right now it splits the entire file by spaces and checks every entry if it's a valid class. This produces a lot of warnings that can be ignored until I find a better solution. One possibility is to supply a regex, to railwind::parse_string
function, like the one used in railwind::lib that's used for collecting the class="..."
attributes.
Oh no wait @apply
does something completely else. I haven't yet looked into functions and directives, but it is something that will be added later.
Thank you so much for taking a look.
In the end the apply function is very similar to classes.
Let's say you have;
.text-center {
@apply justify-center;
}
li {
@apply flex;
}
this will return a css file with:
.text-center {
justify-content: center;
}
li {
display: flex;
}
I will download the lib tomorrow and try to see if I can figure it out
Ok I'm looking to implement this feature. I would need help with the regex to capture the classes.
Sure! I am on vacation this week but i can definitely help next week
Cc @ashleygwilliams