1
1
mirror of https://github.com/rsms/inter.git synced 2024-12-27 09:33:19 +03:00

website: use version in CSS file for cache control instead of font file mtime

This commit is contained in:
Rasmus Andersson 2019-02-07 09:14:35 -08:00
parent 4514cfa3ec
commit 3083a3bb43
4 changed files with 59 additions and 65 deletions

View File

@ -3,13 +3,7 @@
if site.safe == false %}{%
assign url_root = "/" %}{% else %}{%
assign url_root = "/inter/" %}{% endif %}{%
assign font_v = site.data.fontinfo[0].version %}{%
for file in site.static_files %}{%
assign _path = file.path | remove_first: "/inter" %}{%
if _path == "/font-files/Inter-Regular.woff2" %}{%
assign font_v = file.modified_time | date: "%Y%m%d%H%M%S" %}{%
endif %}{%
endfor
%}<link rel="preload" href="{{url_root}}font-files/Inter-upright.var.woff2?v=3.3" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{url_root}}font-files/Inter-italic.var.woff2?v=3.3" as="font" type="font/woff2" crossorigin="anonymous">
%}<link rel="preload" href="{{url_root}}font-files/Inter-upright.var.woff2?v={{font_v}}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{url_root}}font-files/Inter-italic.var.woff2?v={{font_v}}" as="font" type="font/woff2" crossorigin="anonymous">

View File

@ -3,6 +3,12 @@ layout: default
---
{%
assign release_version = site.data.fontinfo[0].version %}{%
capture download_url
%}https://github.com/rsms/inter/releases/download/v{{ release_version }}/Inter-{{ release_version }}.zip{%
endcapture %}{%
for file in site.static_files %}{%
assign _path = file.path | remove_first: "/inter" %}{%
if _path == "/index.css" %}{%
@ -49,7 +55,7 @@ endfor
<h2><a id="usage" href="#usage">How do I use it?</a></h2>
<p>
Using the font is as easy as
<a class="download-link" href="https://github.com/rsms/inter/releases/latest/">download &amp; installing</a> locally on your computer.
<a class="download-link" href="{{download_url}}">downloading &amp; installing</a> on your computer.
</p>
<p>
You're free to bundle copies of Inter with your software, even if it's

View File

@ -1,4 +1,7 @@
/*
---
layout: none
---
{% assign font_v = site.data.fontinfo[0].version %}/*
LEGACY -- this file is deprecated.
@ -12,135 +15,135 @@ Please use "inter.css" instead for new applications.
font-family: 'Inter UI';
font-style: normal;
font-weight: 100;
src: url("font-files/Inter-Thin.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Thin.woff?v=3.3") format("woff");
src: url("font-files/Inter-Thin.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Thin.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 100;
src: url("font-files/Inter-ThinItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-ThinItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-ThinItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-ThinItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 200;
src: url("font-files/Inter-ExtraLight.woff2?v=3.3") format("woff2"),
url("font-files/Inter-ExtraLight.woff?v=3.3") format("woff");
src: url("font-files/Inter-ExtraLight.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-ExtraLight.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 200;
src: url("font-files/Inter-ExtraLightItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-ExtraLightItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-ExtraLightItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-ExtraLightItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 300;
src: url("font-files/Inter-Light.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Light.woff?v=3.3") format("woff");
src: url("font-files/Inter-Light.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Light.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 300;
src: url("font-files/Inter-LightItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-LightItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-LightItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-LightItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 400;
src: url("font-files/Inter-Regular.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Regular.woff?v=3.3") format("woff");
src: url("font-files/Inter-Regular.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Regular.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 400;
src: url("font-files/Inter-Italic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Italic.woff?v=3.3") format("woff");
src: url("font-files/Inter-Italic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Italic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 500;
src: url("font-files/Inter-Medium.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Medium.woff?v=3.3") format("woff");
src: url("font-files/Inter-Medium.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Medium.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 500;
src: url("font-files/Inter-MediumItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-MediumItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-MediumItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-MediumItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 600;
src: url("font-files/Inter-SemiBold.woff2?v=3.3") format("woff2"),
url("font-files/Inter-SemiBold.woff?v=3.3") format("woff");
src: url("font-files/Inter-SemiBold.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-SemiBold.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 600;
src: url("font-files/Inter-SemiBoldItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-SemiBoldItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-SemiBoldItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-SemiBoldItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 700;
src: url("font-files/Inter-Bold.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Bold.woff?v=3.3") format("woff");
src: url("font-files/Inter-Bold.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Bold.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 700;
src: url("font-files/Inter-BoldItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-BoldItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-BoldItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-BoldItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 800;
src: url("font-files/Inter-ExtraBold.woff2?v=3.3") format("woff2"),
url("font-files/Inter-ExtraBold.woff?v=3.3") format("woff");
src: url("font-files/Inter-ExtraBold.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-ExtraBold.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 800;
src: url("font-files/Inter-ExtraBoldItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-ExtraBoldItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-ExtraBoldItalic.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: normal;
font-weight: 900;
src: url("font-files/Inter-Black.woff2?v=3.3") format("woff2"),
url("font-files/Inter-Black.woff?v=3.3") format("woff");
src: url("font-files/Inter-Black.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-Black.woff?v={{font_v}}") format("woff");
}
@font-face {
font-family: 'Inter UI';
font-style: italic;
font-weight: 900;
src: url("font-files/Inter-BlackItalic.woff2?v=3.3") format("woff2"),
url("font-files/Inter-BlackItalic.woff?v=3.3") format("woff");
src: url("font-files/Inter-BlackItalic.woff2?v={{font_v}}") format("woff2"),
url("font-files/Inter-BlackItalic.woff?v={{font_v}}") format("woff");
}
/* --------------------------------------------------------------------------
@ -167,8 +170,8 @@ BUGS:
font-family: 'Inter UI var';
font-weight: 100 900;
font-style: oblique 0deg 10deg;
src: url("font-files/Inter.var.woff2?v=3.3") format("woff2-variations"),
url("font-files/Inter.var.woff2?v=3.3") format("woff2");
src: url("font-files/Inter.var.woff2?v={{font_v}}") format("woff2-variations"),
url("font-files/Inter.var.woff2?v={{font_v}}") format("woff2");
}
/* --------------------------------------------------------------------------
@ -187,16 +190,16 @@ BUGS:
font-weight: 100 900;
font-style: normal;
font-named-instance: 'Regular';
src: url("font-files/Inter-upright.var.woff2?v=3.3") format("woff2 supports variations(gvar)"),
url("font-files/Inter-upright.var.woff2?v=3.3") format("woff2-variations"),
url("font-files/Inter-upright.var.woff2?v=3.3") format("woff2");
src: url("font-files/Inter-upright.var.woff2?v={{font_v}}") format("woff2 supports variations(gvar)"),
url("font-files/Inter-upright.var.woff2?v={{font_v}}") format("woff2-variations"),
url("font-files/Inter-upright.var.woff2?v={{font_v}}") format("woff2");
}
@font-face {
font-family: 'Inter UI var alt';
font-weight: 100 900;
font-style: italic;
font-named-instance: 'Italic';
src: url("font-files/Inter-italic.var.woff2?v=3.3") format("woff2 supports variations(gvar)"),
url("font-files/Inter-italic.var.woff2?v=3.3") format("woff2-variations"),
url("font-files/Inter-italic.var.woff2?v=3.3") format("woff2");
src: url("font-files/Inter-italic.var.woff2?v={{font_v}}") format("woff2 supports variations(gvar)"),
url("font-files/Inter-italic.var.woff2?v={{font_v}}") format("woff2-variations"),
url("font-files/Inter-italic.var.woff2?v={{font_v}}") format("woff2");
}

View File

@ -1,16 +1,7 @@
---
layout: none
---
{%
for file in site.static_files %}{%
assign _path = file.path | remove_first: "/inter" %}{%
if _path == "/font-files/Inter-Regular.woff2" %}{%
assign font_v = file.modified_time | date: "%Y%m%d%H%M%S" %}{%
endif %}{%
endfor
%}
{% assign font_v = site.data.fontinfo[0].version %}
@font-face {
font-family: 'Inter';
font-style: normal;