Skip to content

Commit b084434

Browse files
committed
Sort WOFF2 before WOFF by default, recommend WOFF2
Apparently browsers process the list of fonts in-order and stop at the first supported option. For this reason, it does not make sense to put WOFF2 after WOFF when generating both, as reported in #21. Instead, change the order of the 'all' default format to start with WOFF2 and WOFF, sort the older formats towards the end and change the recommendation to use WOFF2 and WOFF. Closes: #21
1 parent 352849b commit b084434

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ the terms.
4242
webfont formats. Supported identifiers are <code>eot</code>,
4343
<code>woff</code>, <code>woff2</code>, <code>svg</code>, and
4444
<code>ttf</code>. Additionally, the special value <code>all</code>
45-
expands to all supported formats. The default is <code>all</code>. Note
46-
that you may not really need all formats. In most cases, WOFF is enough.
47-
See http://caniuse.com/#search=woff for a current status.</dd>
45+
expands to all supported formats in the order <code>woff2</code>,
46+
<code>woff</code>, <code>eot</code>, <code>svg</code>,
47+
<code>ttf</code>. The default is <code>all</code>. The generated CSS
48+
file will contain the font formats in the given order, which browsers
49+
will process in-order. Note that you probably do not need all formats.
50+
In most cases, a combination of WOFF2 and WOFF is enough. See
51+
http://caniuse.com/#search=woff for a current status.</dd>
4852
<dt><code>-h</code>, <code>--help</code></dt>
4953
<dd>Display this message and exit.</dd>
5054
<dt><code>-l LANGSPEC</code>, <code>--languages=LANGSPEC</code></dt>

google-font-download

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ usage() {
7070
servers. FORMAT is a comma-separated list of identifiers for
7171
webfont formats. Supported identifiers are eot, woff, woff2,
7272
svg, and ttf. Additionally, the special value \`all' expands
73-
to all supported formats. The default is \`$format'. Note
74-
that you may not really need all formats. In most cases,
75-
WOFF is enough. See http://caniuse.com/#search=woff for
76-
a current status.
73+
to all supported formats in the order woff2, woff, eot, svg,
74+
ttf. The default is \`$format'. The generated CSS file will
75+
contain the font formats in the given order, which browsers
76+
will process in-order. Note that you probably do not need
77+
all formats. In most cases, a combination of WOFF2 and WOFF
78+
is enough. See http://caniuse.com/#search=woff for a current
79+
status.
7780
7881
-h, --help
7982
Display this message and exit.
@@ -308,7 +311,7 @@ fi
308311
declare -a formats
309312
if [ "$format" = "all" ]; then
310313
# Deal with the special "all" value
311-
formats=("eot" "woff" "woff2" "svg" "ttf")
314+
formats=("woff2" "woff" "eot" "svg" "ttf")
312315
else
313316
IFS=', ' read -r -a formats <<< "$format"
314317
for f in "${formats[@]}"; do

0 commit comments

Comments
 (0)