1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-26 12:26:34 +03:00

web: update version in resource urls

This commit is contained in:
Rasmus Andersson 2020-08-20 11:18:18 -07:00
parent e9cc7718f3
commit b7435015ca
4 changed files with 49 additions and 48 deletions

View File

@ -5,5 +5,5 @@ assign url_root = "/" %}{% else %}{%
assign url_root = "/inter/" %}{% endif %}{%
assign font_v = site.data.fontinfo[0].version
%}<link rel="preload" href="{{url_root}}font-files/Inter-roman.var.woff2?v=3.15" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{url_root}}font-files/Inter-italic.var.woff2?v=3.15" as="font" type="font/woff2" crossorigin="anonymous">
%}<link rel="preload" href="{{url_root}}font-files/Inter-roman.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

@ -7,16 +7,16 @@ layout: none
font-style: normal;
font-weight: 100;
font-display: swap;
src: url("font-files/Inter-Thin.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Thin.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 100;
font-display: swap;
src: url("font-files/Inter-ThinItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-ThinItalic.woff?{{font_v}}") 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 {
@ -24,16 +24,16 @@ layout: none
font-style: normal;
font-weight: 200;
font-display: swap;
src: url("font-files/Inter-ExtraLight.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-ExtraLight.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 200;
font-display: swap;
src: url("font-files/Inter-ExtraLightItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-ExtraLightItalic.woff?{{font_v}}") 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 {
@ -41,16 +41,16 @@ layout: none
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("font-files/Inter-Light.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Light.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 300;
font-display: swap;
src: url("font-files/Inter-LightItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-LightItalic.woff?{{font_v}}") 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 {
@ -58,16 +58,16 @@ layout: none
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("font-files/Inter-Regular.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Regular.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("font-files/Inter-Italic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Italic.woff?{{font_v}}") 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 {
@ -75,16 +75,16 @@ layout: none
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("font-files/Inter-Medium.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Medium.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 500;
font-display: swap;
src: url("font-files/Inter-MediumItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-MediumItalic.woff?{{font_v}}") 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 {
@ -92,16 +92,16 @@ layout: none
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("font-files/Inter-SemiBold.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-SemiBold.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 600;
font-display: swap;
src: url("font-files/Inter-SemiBoldItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-SemiBoldItalic.woff?{{font_v}}") 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 {
@ -109,16 +109,16 @@ layout: none
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("font-files/Inter-Bold.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Bold.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url("font-files/Inter-BoldItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-BoldItalic.woff?{{font_v}}") 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 {
@ -126,16 +126,16 @@ layout: none
font-style: normal;
font-weight: 800;
font-display: swap;
src: url("font-files/Inter-ExtraBold.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-ExtraBold.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 800;
font-display: swap;
src: url("font-files/Inter-ExtraBoldItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-ExtraBoldItalic.woff?{{font_v}}") 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 {
@ -143,16 +143,16 @@ layout: none
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("font-files/Inter-Black.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-Black.woff?{{font_v}}") 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';
font-style: italic;
font-weight: 900;
font-display: swap;
src: url("font-files/Inter-BlackItalic.woff2?{{font_v}}") format("woff2"),
url("font-files/Inter-BlackItalic.woff?{{font_v}}") 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");
}
/* -------------------------------------------------------
@ -170,7 +170,7 @@ Usage:
font-style: normal;
font-named-instance: 'Regular';
font-display: swap;
src: url("font-files/Inter-roman.var.woff2?{{font_v}}") format("woff2");
src: url("font-files/Inter-roman.var.woff2?v={{font_v}}") format("woff2");
}
@font-face {
font-family: 'Inter var';
@ -178,7 +178,7 @@ Usage:
font-style: italic;
font-named-instance: 'Italic';
font-display: swap;
src: url("font-files/Inter-italic.var.woff2?{{font_v}}") format("woff2");
src: url("font-files/Inter-italic.var.woff2?v={{font_v}}") format("woff2");
}
/* Legacy naming compatibility */
@ -188,7 +188,7 @@ Usage:
font-style: normal;
font-named-instance: 'Regular';
font-display: swap;
src: url("font-files/Inter-roman.var.woff2?{{font_v}}") format("woff2");
src: url("font-files/Inter-roman.var.woff2?v={{font_v}}") format("woff2");
}
@font-face {
font-family: 'Inter var alt';
@ -196,7 +196,7 @@ Usage:
font-style: italic;
font-named-instance: 'Italic';
font-display: swap;
src: url("font-files/Inter-italic.var.woff2?{{font_v}}") format("woff2");
src: url("font-files/Inter-italic.var.woff2?v={{font_v}}") format("woff2");
}
@ -218,5 +218,5 @@ explicitly, e.g.
font-weight: 100 900;
font-style: oblique 0deg 10deg;
font-display: swap;
src: url("font-files/Inter.var.woff2?{{font_v}}") format("woff2");
src: url("font-files/Inter.var.woff2?v={{font_v}}") format("woff2");
}

View File

@ -26,9 +26,9 @@ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
} })(navigator.userAgent);
</script>
<script type="text/javascript" src="samples.js"></script>
<script type="text/javascript" src="build-version.js"></script>
<script type="text/javascript" src="font-files.js"></script>
<script type="text/javascript" src="samples.js?v=3.15"></script>
<script type="text/javascript" src="build-version.js?v=3.15"></script>
<script type="text/javascript" src="font-files.js?v=3.15"></script>
<link href="lab.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i,900,900i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese">
</head>

View File

@ -24,7 +24,7 @@ def updateCSSFile(filename):
def updateHTMLFile(filename):
regex = re.compile(r'(href="[^"]+?v=)([^"]+)(")')
regex = re.compile(r'((?:href|src)="[^"]+?v=)([^"]+)(")')
with open(filename, 'r') as f:
s = f.read()
s = regex.sub(lambda m: '%s%s%s' % (m.group(1), version, m.group(3)), s)
@ -33,7 +33,8 @@ def updateHTMLFile(filename):
updateCSSFile(pjoin(BASEDIR, 'misc', 'dist', 'inter.css'))
updateHTMLFile(pjoin(BASEDIR, 'docs', '_includes', 'preload-font-files.html'))
# updateHTMLFile(pjoin(BASEDIR, 'docs', '_includes', 'preload-font-files.html'))
updateHTMLFile(pjoin(BASEDIR, 'docs', 'lab', 'index.html'))
# Note: The website CSS file uses Jekyll variables to add ?v= so don't need this anymore.
# updateCSSFile(pjoin(BASEDIR, 'docs', 'inter.css'))