-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support style
attribute
#1345
Comments
@BrooklinJazz take note ☝️ this affects the tutorial if you're using this style of class name. You will be able to just change |
As far as implementation goes for the Elixir side, I will likely remove the changes I made to the UtilityStyle module and rely on the existing rules parser. What I'm not sure about is if we should add support for |
As far as why "style" over "modifiers"
|
The other benefit is I believe this will put people on the better path towards wanting a styling framework in the future. Supporting inline-styles along with the escape hatch of supporting class names for styling with multiple modifiers is familiar for those coming from web and I think this will result in less WTFs. |
What about supporting
That way writing modifiers is nearly 1-1. It probably won't be as easy as a split on colon but should be do-able. It could also mean we can solve the whitespace problem. It'd be nice to be able to do stuff like this:
|
I've debated that, it more of less turns it into a pure parser at that point. My only reason, as you surmised, for not doing so is that splitting between the rules requires more than a simple split and you have to start tokenizing the string to find where the outer-most |
Part 1/2 liveview-native/live_view_native#179 |
Why do we bother with HTML encoding? (Why is |
@NduatiK on native devices we're using html parsers and they don't like seeing |
FWIW I am not a fan of having to use |
That's a good point, I forgot about the HTML bits |
This is complete |
I think we should pull the trigger on this as a blocker for v0.3
My changes to the UtilityStyles gave people the ability to write class names that are effectively syntax parity with the actual modifiers. This is looking odd now as it appears to be rules written as class names.
I'd like to move this format for the UtilityStyles over to a
style
attribute:I'm going to make the changes in the Elixir code. The above template should output as:
The HTML entities should be decoded first then the string is split on
;
instead of whitespace.The stylesheet will be identical. The key value will be the pre-decoded version and the value will be post-decoded so the above would result in the following stylesheet:
This would require the client to collect class names from both
class
andstyle
attr. Similar to HTML the modifiers fromstyle
have a higher precdence than the ones fromclass
.As an example, the folllowing HTML:
this will result in a
red
color asstyle
will be applied after the styles fromclass
. However modifier application precedence is done we should ensure that this behavior is similar.Edge cases
Any trailing
;
should be collapsed:The text was updated successfully, but these errors were encountered: