-
-
Notifications
You must be signed in to change notification settings - Fork 215
Open
Description
Hopefully one day the min() function will be implemented by all major browsers and that could simplify RFS a lot. Instead of the mixin, we can make use of a function to generate the value.
For example:
.title {
padding: rfs(2rem);
font-size: rfs(4rem);
}would generate:
.title {
padding: min(2rem, calc(1.325rem + 0.9vw));
font-size: min(4rem, calc(1.525rem + 3.3vw));
}Other positive side effects are:
- We can use the same syntax in every language (sass, scss, less, stylus & PostCSS)
- It's a bit more predictable than the
mixinbecause you know it's going to a value and not "some lines of code" - Mixins don't work with plugins like stylelint-order, the function would fix this.
- Custom properties (css variables) can be set to a value which can be reused in css.
Only downside is that the disabled/enabled classes won't work anymore, but I have no clue if this feature is even used.
Currently Safari kind of supports min(), but it's still not perfect when resizing without the safari iframe hack (#14): https://codepen.io/MartijnCuppens/pen/ywaJpW
Browser support
Browser support is still an issue. Browser support so far:
- Safari
- Chrome (development has started, see https://bugs.chromium.org/p/chromium/issues/detail?id=825895)
- Firefox
- Edge
thasmo, adojck, musaffa, ThomOrlo, marcinszczodry and 6 moremblackritter and ThomOrlomblackritter, ThomOrlo and xpl0siv
Metadata
Metadata
Assignees
Labels
No labels