Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] - are @apply directives supported ? #4

Open
SaraVieira opened this issue Dec 13, 2022 · 6 comments
Open

[question] - are @apply directives supported ? #4

SaraVieira opened this issue Dec 13, 2022 · 6 comments

Comments

@SaraVieira
Copy link

SaraVieira commented Dec 13, 2022

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?

@apply file example

If not I can also try to pitch in to add that if given some direction on where to make changes

@SaraVieira SaraVieira changed the title [question] - are @applly rules supported? [question] - are @applly directives supported ? Dec 13, 2022
@SaraVieira SaraVieira changed the title [question] - are @applly directives supported ? [question] - are @apply directives supported ? Dec 13, 2022
@pintariching
Copy link
Owner

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'.

@pintariching
Copy link
Owner

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.

@pintariching
Copy link
Owner

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.

@SaraVieira
Copy link
Author

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

@pintariching
Copy link
Owner

Ok I'm looking to implement this feature. I would need help with the regex to capture the classes.

@SaraVieira
Copy link
Author

Sure! I am on vacation this week but i can definitely help next week

Cc @ashleygwilliams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants