-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Compose styles #128
Comments
Thank you for opening this issue! A little inside on how things work in Mint:
The combining styles issue came up before as well: #99 Personally I had only a few times that I felt that the language needs some way of combining styles however reading the description I had an idea on how it can be solved property. What do you think about something like this:
Basically Any property in any As for the type checking of the CSS: since most declarations are static and checked at compile time, there will not be any actual type for it, the idea here is to check the values of properties against the CSS spec and throw compile time errors. |
While I really like this, I often looked for a concise way to write this:
Given your proposal I'd instead write it like this:
But what really would make this simple would be allowing arguments to
Maybe that can be a thing in future (not hoping for feature parity with something like SCSS, but they do have some neat stuff). |
I've never thought about giving parameters to |
I like the style with argument and the conditional inside the style body! The
Also, what I had in mind was a way to actually merge styles:
This would take the conditionals outside the style, but should provide enough flexibility to handle most of use cases. So this:
Would be:
No need to copy/paste the style, and the style blocks remain simple. That being said, we might need something more powerful one day, like the ability to return a style object usable anywhere:
|
This is no resolved with the #140 PR 🎉 |
First of all, let me tell you that I really like this project, and hope it will reach v1 and be supported by a bigger community soon!
I have a question regarding the styles. Apparently, there is no way to use more than one style for an HTML node (
<div::foo::bar
is not allowed), and there is also no way to "inject" several css rules in a row (style my-style { width: 20px; {moreStyle} }
throws a parse error), which leaves us with this "computed values" pattern:Which is, in my humble opinion, pretty nice. Except when you need more than one or two computed values! The code gets longer and longer, and might become quite unsafe as well.
I tried to return a record, but it's still quite cumbersome, since anonymous records are apparently not supported in Mint, and therefore requires you to declare the record type additionally to the returned value.
So my question is; is there a better way to handle this use case? If not, is anything planned in the future?
The roadmap says there will be some type checking for the css, meaning there will probably be some
Css
orStyle
type one day, making this:get computedStyle : Css { ... }
possible.The text was updated successfully, but these errors were encountered: