-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Use CSS Vars to allow direct passthrough of tailwind variables #40
Comments
I would be happy to do this solution if this is something you want to implement, either now or in the future. |
Hi @The-Code-Monkey , Thank you for the suggestions , but I guess it will add more complexity to the syntax. |
It depends on which option you look at the second one is not too much syntax and follows a very similar format to how tailwind themselves do stuff. the first one option is a little more complex but again not too complex its less complex than what im currently doing in my component lib thats using mist. https://github.com/The-Code-Monkey/MistKit/blob/master/src/primals/flex/index.mist.css it would make something like this so much cleaner and extendable for custom tailwind values. as all i would have would be
This is much cleaner than current solution and more dynamic. |
Wow, Yep I liked it. |
Just have to get @typicode on side now ha ha |
I've been thinking about CSS variables as well :) So yes, MistCSS should support them. I'd like to a simple way to ignore computed CSS var or distinguish between "public"/"private". For example:
I'd like the generated component to expose |
Yeah I like that idea of how certain values are exposed and others aren't. I think exposed values should be strings, numbers, CSS vars like my example above but yeah things like calc wouldn't be exposed |
I'm currently working on a basic implementation for variables currently it will be finished off tomorrow morning and I'll submit it for review |
I have an implementation written @alamenai typicode is working on refactoring so in the meantime i published my own so i can continue dev, don't recommend using it though as it will be removed once typicode is done with their refactor. And it is also will be buggy as i will test stuff in it. https://github.com/The-Code-Monkey/mistcss/tree/v-andy you can see it in action here |
An alternative to this, that can work with the current CSS variable implementation, could be to use the Tailwind variables in JS. For example:
https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/config.full.js This would have the benefit of having TS check that the keys used are valid.
I haven't done research into exactly how this this can imported. Edit: Getting Tailwind variables is possible this way: const defaultTheme = require('tailwindcss/defaultTheme') |
Yeah this is what I would like to support maybe via a specific tailwind renderer. E.g. react tailwind. But I would personally say for things like padding should be just 8 not spacing.8 as we should be able to infer the tailwind schema it belongs to. I'll have a look at supporting something next week |
I see. I understand it could be easier but I think it could be possible with the existing code. If you wrap Mist components in a function that would convert |
This is a suggestion on how to handle #36 as it sounds pretty interesting.
The way i was thinking of it was to enable the use of something like
which the parser would see this as
I know its not the prettiest solution but it could work in terms of how simple it is, or maybe we could even remove the need for the &[data-padding] somehow and resolve this value from the --padding var directly e.g.
this way we could infer that for padding prop to grab the first half of the assigned ts variable and then concat the prop onto the end.
The text was updated successfully, but these errors were encountered: