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
Idea: ability to set a default unit, then use Numbers instead of strings. #33
Comments
Or perhaps even something more advanced that would let default units to be specified for specific properties, e.g. jss.createStyleSheet(style, {
units: {
default: 'px',
'font-size': 'em' // override default
}
}); |
I already had a default for numbers - px. Removed it. This is problematic, not all styles can be defined in em, not all in px f.e. z-index is pure number Also more or less ok from the performance are values with just one definition, like height: 10, but if you get something like border: 1 solid red; you need to parse more to add unit to the number. Maybe it is a task for a preprocessor. |
By having more than 1 default unit, you make styles uncomposable in case you want to mix styles with different default units to create a new style. |
I am not sure all the problems worth it. |
True. I haven't tried composing yet. Closing since yeah, it sounds complicated. xD |
I am still thinking to make the px default similar to jquery as a jss plugin. |
gss also uses a px default. |
https://github.com/jsstyles/jss-px works same way as in jquery. |
OOOOhhhh yeaaaaah. Niiiice. |
px
would be the default. For example, so that we can replacewith
but if a different unit than the default
px
is wanted, then perhaps something likeThe text was updated successfully, but these errors were encountered: