Open kvidek opened 6 years ago
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
As you can see woff2 is for the Super Modern Browsers. I think that this format was meant for the latest release(s) of the browser(s)? New Chrome, Firefox, etc.
Can we exclude SVG file format?
https://caniuse.com/#feat=woff2 Support for woff2 greatly increased since that mixin was initially developed, I believe.
Here are referenced current best practices for webfont loading, and basically summary is:
url('/fonts/awesome.woff2') format('woff2'),
url('/fonts/awesome.woff') format('woff'),
url('/fonts/awesome.ttf') format('truetype'),
url('/fonts/awesome.eot') format('embedded-opentype');
Browsers will fallback to eot if they fail to use modern versions so we should change that.
But I agree, we could set another parameter for specifying font types to use and ditch the SVG completely.
Also, we need to add parameters for font-weight
and font-style
so the same font names can be used.
mixins/_fonts.scss (L:1)
mixin requires all formats, should ignore if a file format does not exist (e.g. not all fonts have .woff2 format)