See https://github.com/Fyrd/caniuse/issues/2918 for caniuse feature inclusion.
It would be nice if autoprefixer replaced font-family: system-ui; with this:
font-family: system-ui,
-apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
(adapted from https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/ )
Technically it is not a prefix :-/. But I agree that it is useful and people may expect it from Autoprefixer.
Is system-ui is standard value? Will browsers support it in future?
It's been approved by the whatwg ( https://drafts.csswg.org/css-fonts-4/#valdef-font-family-system-ui ) and it's supported in chrome 56 (currently in beta).
I asked a community for feedback https://twitter.com/autoprefixer/status/814506174468984832
Maybe we should add it to postcss-cssnext. I think it is a better place for standard polyfills. But letâs wait a feedback from Twitter users.
I think extending system-ui to the complete font list from above can be problematic. There is not âthe oneâ list that is correct IMO, itâs just a best practice for now and may be different depending on the user base. The linked Smashing Magazine article itself notes that âthis is not future-proofâ and âThe list targets the most popular browsers and operating systems, but it doesnât target all of themâ.
I think it would be nice if autoprefixer extends system-ui to only system-ui, -apple-system, BlinkMacSystemFont which are all equivalent AFAIK and that would be some kind of âprefixingâ. The list of fallback fonts should be up to the CSS author (or to cssnext).
I'd love to see this added, and prefer @ausi's suggestion. Unfurl it to just the system font names that the vendors have exposed, and leave everything else to author preference.
I think autoprefixer should only deal with the prefix and private value.
Input:
font-family: system-ui, sans-serif;
Output:
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
@yisibl good idea!
@jltrv could you start with PR to caniuse with data for prefixes?
@ai working on it
I decide, that it is not a Autoprefixer deal. You could make a custom PostCSS plugin and we will add it to cssnext and add links from Autoprefixer docs.
Do you need help with it?
@ai Is there a specific reason why you decided that way?
I think expanding system-ui to system-ui, -apple-system, BlinkMacSystemFont would be a good fit for autoprefixer.
@ausi I think polyfill is much better solution for this problem. Linux and Android users are important too, but system-ui, -apple-system, BlinkMacSystemFont doesnât cover them.
AFAIK system-ui will be supported on Linux and Android too according to Chrome Platform Status.
For your information, I just composed a postcss plugin postcss-font-family-system-ui to transform
body {
font-family: system-ui;
}
into
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue;
}
@JLHwung great! Please send it to FAQ section in Autoprefixer README!
I will try to promote it tomorrow in PostCSS twitter (if I will not forget :D)
@ai Sure. PR is raised.
ŃпаŃĐžĐ±ĐŸ.
Most helpful comment
I think extending
system-uito the complete font list from above can be problematic. There is not âthe oneâ list that is correct IMO, itâs just a best practice for now and may be different depending on the user base. The linked Smashing Magazine article itself notes that âthis is not future-proofâ and âThe list targets the most popular browsers and operating systems, but it doesnât target all of themâ.I think it would be nice if autoprefixer extends
system-uito onlysystem-ui, -apple-system, BlinkMacSystemFontwhich are all equivalent AFAIK and that would be some kind of âprefixingâ. The list of fallback fonts should be up to the CSS author (or to cssnext).