1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 13:05:48 -04:00

reorganize external static assets into vendor folder (#99)

with legacy redirects via Netlify for now
This commit is contained in:
2020-04-04 12:03:04 -04:00
committed by GitHub
parent 55a696c261
commit 48498c772f
15 changed files with 47 additions and 37 deletions

View File

@@ -12,13 +12,13 @@ $unicode-subset: U+0000-00FF, U+2000-206F, U+20A0-20CF, U+2190-21FF, U+2200-22FF
* Licensed under the SIL Open Font License, Version 1.1:
* https://github.com/rsms/inter/blob/v3.12/LICENSE.txt
*/
@include font-face("Inter", "fonts/inter-regular-subset", 400) {
@include font-face("Inter", "vendor/inter/inter-regular-subset", 400) {
unicode-range: $unicode-subset;
}
@include font-face("Inter", "fonts/inter-medium-subset", 500) {
@include font-face("Inter", "vendor/inter/inter-medium-subset", 500) {
unicode-range: $unicode-subset;
}
@include font-face("Inter", "fonts/inter-bold-subset", 700) {
@include font-face("Inter", "vendor/inter/inter-bold-subset", 700) {
unicode-range: $unicode-subset;
}
@@ -29,4 +29,4 @@ $unicode-subset: U+0000-00FF, U+2000-206F, U+20A0-20CF, U+2190-21FF, U+2200-22FF
* Licensed under the MIT License:
* https://github.com/source-foundry/Hack/blob/v3.003/LICENSE.md
*/
@include font-face("Hack", "fonts/hack-regular-subset", 400);
@include font-face("Hack", "vendor/hack/hack-regular-subset", 400);

View File

@@ -35,6 +35,14 @@ disableAliases = true
licenseURL = "https://creativecommons.org/licenses/by/4.0/"
utterancesRepo = "jakejarvis/jarv.is"
[module]
[[module.imports]]
path = "github.com/twitter/twemoji"
disabled = false
[[module.imports.mounts]]
source = "v/12.1.5"
target = "static/vendor/emoji"
[author]
name = "Jake Jarvis"
jobTitle = "Front-End Web Developer"
@@ -139,16 +147,8 @@ disableAliases = true
noClasses = true
tabWidth = 4
[module]
[[module.imports]]
path = "github.com/twitter/twemoji"
disabled = false
[[module.imports.mounts]]
source = "v/12.1.5"
target = "static/twemoji"
[privacy]
[privacy.twitter]
enableDNT = true
[privacy.youtube]
privacyEnhanced = true
[server]
[[server.headers]]
for = "/**"
[server.headers.values]
Access-Control-Allow-Origin = "*"

View File

@@ -26,8 +26,8 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("{{ "fonts/inter-regular-subset.woff2" | absURL }}") format("woff2"),
url("{{ "fonts/inter-regular-subset.woff" | absURL }}") format("woff");
src: url("{{ "vendor/inter/inter-regular-subset.woff2" | absURL }}") format("woff2"),
url("{{ "vendor/inter/inter-regular-subset.woff" | absURL }}") format("woff");
unicode-range: U+0000-00FF, U+2000-206F, U+20A0-20CF,
U+2190-21FF, U+2200-22FF, U+2122;
}
@@ -36,8 +36,8 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("{{ "fonts/inter-medium-subset.woff2" | absURL }}") format("woff2"),
url("{{ "fonts/inter-medium-subset.woff" | absURL }}") format("woff");
src: url("{{ "vendor/inter/inter-medium-subset.woff2" | absURL }}") format("woff2"),
url("{{ "vendor/inter/inter-medium-subset.woff" | absURL }}") format("woff");
unicode-range: U+0000-00FF, U+2000-206F, U+20A0-20CF,
U+2190-21FF, U+2200-22FF, U+2122;
}
@@ -46,8 +46,8 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("{{ "fonts/inter-bold-subset.woff2" | absURL }}") format("woff2"),
url("{{ "fonts/inter-bold-subset.woff" | absURL }}") format("woff");
src: url("{{ "vendor/inter/inter-bold-subset.woff2" | absURL }}") format("woff2"),
url("{{ "vendor/inter/inter-bold-subset.woff" | absURL }}") format("woff");
unicode-range: U+0000-00FF, U+2000-206F, U+20A0-20CF,
U+2190-21FF, U+2200-22FF, U+2122;
}
@@ -56,8 +56,8 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("{{ "fonts/hack-regular-subset.woff2" | absURL }}") format("woff2"),
url("{{ "fonts/hack-regular-subset.woff" | absURL }}") format("woff");
src: url("{{ "vendor/hack/hack-regular-subset.woff2" | absURL }}") format("woff2"),
url("{{ "vendor/hack/hack-regular-subset.woff" | absURL }}") format("woff");
}
body {

View File

@@ -6,13 +6,9 @@
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
# Super long cache for web fonts (one year)
/fonts/*
Cache-Control: max-age=31536000, public, immutable, no-transform
# Super long cache for Twemojis (one year)
/twemoji/*
Cache-Control: max-age=31536000, public, immutable, no-transform
# Super long cache for web fonts and Twemojis (one year)
/vendor/*
Cache-Control: max-age=31536000, public, immutable
# Recommended MIME type for PWA manifests
# https://github.com/w3c/manifest/issues/689

View File

@@ -7,6 +7,6 @@
{{ end }}
{{ end }}
<link rel="preload" href="{{ "fonts/inter-regular-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{ "fonts/inter-medium-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{ "fonts/inter-bold-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{ "vendor/inter/inter-regular-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{ "vendor/inter/inter-medium-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{ "vendor/inter/inter-bold-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin="anonymous">

View File

@@ -1,2 +1,2 @@
<script src="{{ "/twemoji/twemoji.min.js" | absURL }}"></script>
<script>twemoji.parse(document.body,{{ dict "base" ("/" | absURL) "folder" "twemoji/svg" "ext" ".svg" | jsonify | safeJS }})</script>
<script src="{{ "/vendor/emoji/twemoji.min.js" | absURL }}"></script>
<script>twemoji.parse(document.body,{{ dict "base" ("/" | absURL) "folder" "vendor/emoji/svg" "ext" ".svg" | jsonify | safeJS }})</script>

View File

@@ -139,6 +139,20 @@
to = "https://modest-jackson-d5516b.netlify.com/awesome/:splat"
status = 200
# Reorganized static assets; this can probably be temporary:
[[redirects]]
from = "/fonts/inter-*"
to = "/vendor/inter/inter-:splat"
status = 301
[[redirects]]
from = "/fonts/hack-*"
to = "/vendor/hack/hack-:splat"
status = 301
[[redirects]]
from = "/twemoji/*"
to = "/vendor/emoji/:splat"
status = 301
# More miscellaneous mirrors:
[[redirects]]
from = "/apple-touch-icon-precomposed.png"