mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 14:28:25 -04:00
finally remove every trace of AMP 🥳 (#415)
This commit is contained in:
parent
4bb5841ac1
commit
3fa058ee76
@ -11,7 +11,7 @@
|
||||
"es6": true
|
||||
},
|
||||
"overrides": [{
|
||||
"files": ["{functions,plugins}/**/*.js"],
|
||||
"files": ["functions/**/*.js"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 8,
|
||||
"sourceType": "module"
|
||||
|
31
.github/dependabot.yml
vendored
31
.github/dependabot.yml
vendored
@ -14,30 +14,6 @@ updates:
|
||||
- "npm"
|
||||
- "dependencies"
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: "/plugins/netlify-plugin-amp-optimizer"
|
||||
schedule:
|
||||
interval: weekly
|
||||
versioning-strategy: increase
|
||||
commit-message:
|
||||
prefix: "📦 build(amp):"
|
||||
labels:
|
||||
- "build plugins"
|
||||
- "npm"
|
||||
- "dependencies"
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: "/plugins/netlify-plugin-cache"
|
||||
schedule:
|
||||
interval: weekly
|
||||
versioning-strategy: increase
|
||||
commit-message:
|
||||
prefix: "📦 build(cache):"
|
||||
labels:
|
||||
- "build plugins"
|
||||
- "npm"
|
||||
- "dependencies"
|
||||
|
||||
- package-ecosystem: docker
|
||||
directory: "/"
|
||||
schedule:
|
||||
@ -51,10 +27,3 @@ updates:
|
||||
interval: weekly
|
||||
commit-message:
|
||||
prefix: "📦 ci:"
|
||||
|
||||
- package-ecosystem: pip
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
commit-message:
|
||||
prefix: "📦 pip:"
|
||||
|
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -47,16 +47,14 @@ jobs:
|
||||
run: |
|
||||
lhci autorun \
|
||||
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/ \
|
||||
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/notes/netlify-analytics-review/ \
|
||||
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/notes/how-to-pull-request-fork-github/amp.html
|
||||
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/notes/how-to-pull-request-fork-github/
|
||||
- name: Audit production site
|
||||
if: "github.event_name == 'push' && github.ref == 'refs/heads/main'"
|
||||
continue-on-error: true
|
||||
run: |
|
||||
lhci autorun \
|
||||
--collect.url=https://jarv.is/ \
|
||||
--collect.url=https://jarv.is/notes/netlify-analytics-review/ \
|
||||
--collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/amp.html
|
||||
--collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/
|
||||
- name: Upload results as artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
if: success()
|
||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -11,6 +11,9 @@ npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local Netlify config
|
||||
.netlify/
|
||||
|
||||
# Lighthouse CI
|
||||
.lighthouseci/
|
||||
|
||||
@ -26,8 +29,3 @@ yarn-error.log*
|
||||
.Trashes
|
||||
*.icloud
|
||||
.nosync
|
||||
|
||||
# local Netlify/Zeit config
|
||||
.netlify/
|
||||
.now/
|
||||
.vercel/
|
||||
|
@ -7,6 +7,8 @@
|
||||
"preset": "lighthouse:no-pwa",
|
||||
"assertions": {
|
||||
"color-contrast": "warn",
|
||||
"errors-in-console": "warn",
|
||||
"inspector-issues": "warn",
|
||||
"link-text": "warn",
|
||||
"long-tasks": "warn",
|
||||
"non-composited-animations": "warn",
|
||||
|
@ -7,8 +7,7 @@ snapshot:
|
||||
iframe,
|
||||
video,
|
||||
img[src$=".gif"],
|
||||
.i-amphtml-element,
|
||||
#hit-spinner, #hit-spinner {
|
||||
div#meta-hits {
|
||||
display: none !important; /* don't worry about third-party content/embeds */
|
||||
}
|
||||
code,
|
||||
@ -21,7 +20,7 @@ snapshot:
|
||||
}
|
||||
static-snapshots:
|
||||
path: public/
|
||||
snapshot-files: 'index.html,uses/index.html,notes/{netlify-analytics-review,shodan-search-queries,dropping-dropbox,coronavirus-open-source}/*.html'
|
||||
snapshot-files: 'index.html,uses/index.html,notes/{netlify-analytics-review,shodan-search-queries,dropping-dropbox,coronavirus-open-source}/index.html'
|
||||
agent:
|
||||
asset-discovery:
|
||||
network-idle-timeout: 2000 # ms
|
||||
|
@ -16,12 +16,9 @@ postcss.config.js
|
||||
devcontainer.json
|
||||
|
||||
# miscellaneous
|
||||
plugins/
|
||||
.github/
|
||||
.lighthouseci/
|
||||
.netlify/
|
||||
.now/
|
||||
.vercel/
|
||||
.vscode/
|
||||
LICENSE.md
|
||||
content/notes/dark-mode/example.html
|
||||
|
10
config.toml
10
config.toml
@ -98,7 +98,7 @@ disableAliases = true
|
||||
[outputs]
|
||||
home = ["HTML", "RSS", "ATOM", "MANIFEST", "REDIRECTS", "HEADERS"]
|
||||
section = ["HTML"]
|
||||
page = ["HTML", "AMP"]
|
||||
page = ["HTML"]
|
||||
|
||||
[outputFormats]
|
||||
[outputFormats.RSS]
|
||||
@ -111,12 +111,6 @@ disableAliases = true
|
||||
baseName = "feed" # /feed.atom
|
||||
isPlainText = false
|
||||
isHTML = false
|
||||
[outputFormats.AMP]
|
||||
mediaType = "text/html"
|
||||
baseName = "amp" # amp.html
|
||||
path = "." # put in same directory as original post
|
||||
permalinkable = true
|
||||
isHTML = true
|
||||
[outputFormats.MANIFEST]
|
||||
mediaType = "application/manifest+json" # https://github.com/w3c/manifest/issues/689
|
||||
baseName = "site" # /site.webmanifest
|
||||
@ -200,5 +194,3 @@ disableAliases = true
|
||||
for = "/**"
|
||||
[server.headers.values]
|
||||
Access-Control-Allow-Origin = "*"
|
||||
# uncomment to get hashes of inline scripts via console errors:
|
||||
# content-security-policy = "script-src 'self';"
|
||||
|
@ -4,7 +4,6 @@ date: 2021-05-26 21:40:49-0400
|
||||
type: home
|
||||
sitemap:
|
||||
priority: 1.0
|
||||
amp: false
|
||||
---
|
||||
|
||||
# Hi there! I'm Jake. <span class="wave">👋</span>
|
||||
|
@ -1,19 +0,0 @@
|
||||
{{ partial "amp/head" . }}
|
||||
|
||||
<article class="layout layout-etc">
|
||||
{{ with .OutputFormats.Get "html" }}
|
||||
<div id="meta">
|
||||
<a href="{{ .Permalink }}" title="View Full Version">View Full Version</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ with .OutputFormats.Get "html" }}
|
||||
<h1 class="title"><a href="{{ .Permalink }}">{{ $.Title | markdownify }}</a></h1>
|
||||
{{ end }}
|
||||
|
||||
<div id="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{{ partial "amp/foot" . }}
|
@ -1,17 +0,0 @@
|
||||
{{ partial "amp/head" . }}
|
||||
|
||||
<article class="layout layout-single">
|
||||
<div id="meta">
|
||||
<span title="{{ .Date.Format "Mon, Jan 2 2006 3:04:05 PM MST" }}">{{ .Date.Format "January 2, 2006" }}</span>{{ with .OutputFormats.Get "html" }}<span class="dash">—</span><a href="{{ .Permalink }}" title="View Full Version">View Full Version</a>{{ end }}
|
||||
</div>
|
||||
|
||||
{{ with .OutputFormats.Get "html" }}
|
||||
<h1 class="title"><a href="{{ .Permalink }}">{{ $.Title | markdownify }}</a></h1>
|
||||
{{ end }}
|
||||
|
||||
<div id="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{{ partial "amp/foot" . }}
|
@ -1,28 +0,0 @@
|
||||
{{ partial "amp/head" . }}
|
||||
|
||||
<article class="layout layout-video">
|
||||
{{ with .OutputFormats.Get "html" }}
|
||||
<h1 class="title"><a href="{{ .Permalink }}">{{ $.Title | markdownify }}</a></h1>
|
||||
{{ end }}
|
||||
|
||||
<amp-video
|
||||
layout="responsive"
|
||||
width="{{ .Site.Params.Theme.maxWidth }}"
|
||||
height="530"
|
||||
{{ with .Resources.GetMatch "thumb.*" }}poster="{{ .Permalink }}"{{ end }}
|
||||
controls>
|
||||
{{ with .Page.Resources.GetMatch "*.webm" }}<source src="{{ .Permalink }}" type="video/webm">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch "*.mp4" }}<source src="{{ .Permalink }}" type="video/mp4">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch "*.ogg" }}<source src="{{ .Permalink }}" type="video/ogg">{{ end }}
|
||||
|
||||
{{ with .Page.Resources.GetMatch "*.vtt" }}<track src="{{ .Permalink }}" kind="captions" label="English" srclang="en" default>{{ end }}
|
||||
|
||||
<div fallback>
|
||||
<p>Your browser does not support HTML5 video. {{ with .Page.Resources.GetMatch "*.mp4" }}<a href="{{ .Permalink }}">Load the .mp4 video directly.</a>{{ end }}</p>
|
||||
</div>
|
||||
</amp-video>
|
||||
|
||||
{{ .Content }}
|
||||
</article>
|
||||
|
||||
{{ partial "amp/foot" . }}
|
@ -7,15 +7,10 @@
|
||||
/site.webmanifest
|
||||
Content-Type: application/manifest+json
|
||||
|
||||
# AMP cache invalidation key requirements:
|
||||
# https://developers.google.com/amp/cache/update-cache#update-cache-guidelines
|
||||
/.well-known/amphtml/apikey.pub
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
|
||||
# Set matching Onion-Location headers for each permalink
|
||||
{{- range $page := .Site.Pages }}
|
||||
{{- range .AlternativeOutputFormats }}
|
||||
{{ .RelPermalink }}
|
||||
Onion-Location: {{ $.Site.Params.baseOnionURL }}{{ .RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
@ -19,3 +19,8 @@
|
||||
{{ . }} {{ $page.RelPermalink }} 301
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
# Redirect old AMP URLs to the normal HTML page
|
||||
{{- range $page := .Site.Pages }}
|
||||
{{ print .RelPermalink "amp.html" }} {{ .RelPermalink }} 301!
|
||||
{{ end -}}
|
||||
|
@ -1,14 +0,0 @@
|
||||
<footer>
|
||||
<div class="row">
|
||||
<div class="left">Content by <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>, licensed under <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.license.nameLong }} title="{{ . }}"{{ end }}>{{ .Site.Params.license.name }}</a>.</div>
|
||||
<div class="right"><a class="back-to-top" href="#top">↑ Back to top.</a></div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{{ if eq hugo.Environment "production" }}
|
||||
<amp-pixel src="{{ "api/count_view" | absURL }}?p=CANONICAL_PATH&h=SOURCE_URL&r=EXTERNAL_REFERRER&sid=PPSQZUDY" layout="nodisplay"></amp-pixel>
|
||||
{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{{ partialCached "functions/debug" . }}
|
@ -1,287 +0,0 @@
|
||||
<!doctype html>
|
||||
<html ⚡ lang="{{ .Site.LanguageCode | default "en" }}">
|
||||
<head>
|
||||
{{ partial "functions/init" . }}
|
||||
<meta charset="utf-8">
|
||||
{{ hugo.Generator }}
|
||||
{{ if ne hugo.Environment "production" }}<meta name="robots" content="noindex, nofollow">{{ end }}
|
||||
<script async src="https://cdn.ampproject.org/v0.js"></script>
|
||||
<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>
|
||||
{{ if .HasShortcode "video" }}<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>{{ end }}
|
||||
{{ if .HasShortcode "youtube" }}<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>{{ end }}
|
||||
{{ if .HasShortcode "tweet" }}<script async custom-element="amp-twitter" src="https://cdn.ampproject.org/v0/amp-twitter-0.1.js"></script>{{ end }}
|
||||
{{ if .HasShortcode "facebook" }}<script async custom-element="amp-facebook" src="https://cdn.ampproject.org/v0/amp-facebook-0.1.js"></script>{{ end }}
|
||||
{{ if .HasShortcode "gist" }}<script async custom-element="amp-gist" src="https://cdn.ampproject.org/v0/amp-gist-0.1.js"></script>{{ end }}
|
||||
{{ if .HasShortcode "instagram" }}<script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-0.1.js"></script>{{ end }}
|
||||
{{ if .HasShortcode "vimeo" }}<script async custom-element="amp-vimeo" src="https://cdn.ampproject.org/v0/amp-vimeo-0.1.js"></script>{{ end }}
|
||||
<title>{{ .Scratch.Get "plainTitle" }} – {{ .Site.Title }}</title>
|
||||
{{ with .OutputFormats.Get "html" }}<link rel="canonical" href="{{ .Permalink }}">{{ end }}
|
||||
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
|
||||
{{ with .Site.Author.name }}<meta name="author" content="{{ . }}">{{ end }}
|
||||
<meta name="viewport" content="width=device-width">
|
||||
{{ partial "head/open-graph" . }}
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=fallback">
|
||||
|
||||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
|
||||
<style amp-custom>
|
||||
body {
|
||||
font-family: "Inter", sans-serif;
|
||||
font-kerning: normal;
|
||||
font-size: 0.9em;
|
||||
letter-spacing: -0.011em;
|
||||
background-color: #ffffff;
|
||||
color: #222222;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
a {
|
||||
color: #0e6dc2;
|
||||
text-decoration: none;
|
||||
}
|
||||
hr {
|
||||
margin: 1.25em auto;
|
||||
height: 2px;
|
||||
border: 0;
|
||||
background-color: #d2d2d2;
|
||||
}
|
||||
strong {
|
||||
letter-spacing: 0.008em;
|
||||
}
|
||||
blockquote {
|
||||
border-left: 3px solid #0e6dc2;
|
||||
margin-left: 0.5em;
|
||||
padding-left: 1em;
|
||||
}
|
||||
article {
|
||||
max-width: {{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }};
|
||||
margin: 0 auto;
|
||||
padding: 0 15px;
|
||||
line-height: 1.75;
|
||||
}
|
||||
div#content {
|
||||
font-size: 1em;
|
||||
letter-spacing: -0.006em;
|
||||
}
|
||||
div#content p {
|
||||
margin: 0.75em 0;
|
||||
}
|
||||
div#content ol, div#content ul {
|
||||
margin-left:1.5em;
|
||||
padding-left:0;
|
||||
}
|
||||
div#content ol li, div#content ul li {
|
||||
padding-left:.25em;
|
||||
}
|
||||
div#content a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
h1.title {
|
||||
font-size: 2em;
|
||||
line-height: 1.3;
|
||||
margin-top: 0.4em;
|
||||
margin-bottom: 0.4em;
|
||||
margin-left: -0.03em;
|
||||
}
|
||||
h1.title a {
|
||||
color: inherit;
|
||||
}
|
||||
div#meta {
|
||||
font-size: 0.925em;
|
||||
line-height: 1.3;
|
||||
letter-spacing: 0.04em;
|
||||
margin-top: 1.5em;
|
||||
color: #5e5e5e;
|
||||
}
|
||||
div#meta a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
div#meta span.dash {
|
||||
margin: 0 0.7em;
|
||||
}
|
||||
p.center, p.image, p.caption {
|
||||
text-align: center;
|
||||
}
|
||||
p.caption {
|
||||
margin-top: -1em;
|
||||
font-size: 0.95em;
|
||||
color: #5e5e5e;
|
||||
}
|
||||
h2 {
|
||||
padding-bottom: 0.1em;
|
||||
border-bottom: 1px solid #e3e3e3;
|
||||
}
|
||||
header {
|
||||
width: 100%;
|
||||
background-color: #fcfcfc;
|
||||
border-bottom: 1px solid #e3e3e3;
|
||||
}
|
||||
header a {
|
||||
text-decoration: none;
|
||||
}
|
||||
nav {
|
||||
max-width: {{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }};
|
||||
margin: 0 auto;
|
||||
padding: 0 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
nav a#logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #515151;
|
||||
padding: 10px 0;
|
||||
}
|
||||
nav a#logo #selfie {
|
||||
height: 45px;
|
||||
width: 45px;
|
||||
border: 1px solid #d2d2d2;
|
||||
border-radius: 50%;
|
||||
}
|
||||
nav a#logo span {
|
||||
margin-left: 12px;
|
||||
font-size: 1.25em;
|
||||
font-weight: 500;
|
||||
}
|
||||
nav ul {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 1.65em;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
nav ul li {
|
||||
width: 60px;
|
||||
text-align: right;
|
||||
}
|
||||
footer {
|
||||
padding: 20px 15px;
|
||||
background-color: #fcfcfc;
|
||||
border-top: 1px solid #e3e3e3;
|
||||
color: #555;
|
||||
line-height: 1.8;
|
||||
}
|
||||
footer a {
|
||||
text-decoration: none;
|
||||
}
|
||||
footer div {
|
||||
vertical-align: middle;
|
||||
height: 100%;
|
||||
}
|
||||
footer div.row {
|
||||
width: 100%;
|
||||
max-width: {{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }};
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
div.left {
|
||||
text-align: left;
|
||||
}
|
||||
div.right {
|
||||
text-align: right;
|
||||
}
|
||||
code {
|
||||
font-family: "Roboto Mono", monospace;
|
||||
font-size: 0.925em;
|
||||
letter-spacing: 0;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
div.highlight, code {
|
||||
margin: 0 0.1em;
|
||||
line-height: 1.6;
|
||||
}
|
||||
:not(pre) > code {
|
||||
border: 1px solid #dddddd;
|
||||
padding: 0.075em 0.325em;
|
||||
background-color: #fbfbfb;
|
||||
}
|
||||
h1.title code {
|
||||
font-size: 1em;
|
||||
font-weight: 600;
|
||||
background: none;
|
||||
border: 0;
|
||||
margin: 0 0.075em;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
article.layout-video p {
|
||||
text-align: center;
|
||||
font-size: 0.95em;
|
||||
letter-spacing: -0.005em;
|
||||
line-height: 1.5;
|
||||
color: #757575;
|
||||
margin: 1.5em 1em 1.5em 1em;
|
||||
}
|
||||
article.layout-video p a {
|
||||
font-weight: bold;
|
||||
letter-spacing: 0.001em;
|
||||
}
|
||||
article.layout-video h1.title {
|
||||
text-align: center;
|
||||
margin: 0.7em 0;
|
||||
}
|
||||
article.layout-video amp-video {
|
||||
margin: 1.25em 0;
|
||||
}
|
||||
|
||||
div.highlight {
|
||||
border: 1px solid #dddddd;
|
||||
background-color: #fbfbfb;
|
||||
line-height: 1.6;
|
||||
max-width: 100%;
|
||||
overflow-x: scroll;
|
||||
object-fit: scale-down;
|
||||
margin: 1em 0;
|
||||
}
|
||||
div.highlight pre {
|
||||
display: block;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
div.highlight code {
|
||||
margin: 0;
|
||||
}
|
||||
div.highlight span.k, div.highlight span.kc, div.highlight span.kd, div.highlight span.kp, div.highlight span.kr, div.highlight span.kt, div.highlight span.no { color: #0e6dc2; }
|
||||
div.highlight span.n, div.highlight span.bp, div.highlight span.nb, div.highlight span.ni, div.highlight span.fm, div.highlight span.nl, div.highlight span.nn, div.highlight span.py, div.highlight span.nv, div.highlight span.vc, div.highlight span.vg, div.highlight span.vi, div.highlight span.vm, div.highlight span.p { color: #111111; }
|
||||
div.highlight span.na, div.highlight span.nc, div.highlight span.nd, div.highlight span.ne, div.highlight span.nf, div.highlight span.nx { color: #337a15; }
|
||||
div.highlight span.err, div.highlight span.nt, div.highlight span.o, div.highlight span.ow, div.highlight span.kn { color: #d43d2e; }
|
||||
div.highlight span.l, div.highlight span.se, div.highlight span.m, div.highlight span.mb, div.highlight span.mf, div.highlight span.mh, div.highlight span.mi, div.highlight span.il, div.highlight span.mo { color: #7e3df3; }
|
||||
div.highlight span.ld, div.highlight span.s, div.highlight span.sa, div.highlight span.sb, div.highlight span.sc, div.highlight span.dl, div.highlight span.sd, div.highlight span.s2, div.highlight span.sh, div.highlight span.si, div.highlight span.sx, div.highlight span.sr, div.highlight span.s1, div.highlight span.ss { color: #bd5500; }
|
||||
div.highlight span.c, div.highlight span.ch, div.highlight span.cm, div.highlight span.c1, div.highlight span.cs, div.highlight span.cp, div.highlight span.cpf { color: #6b6859; }
|
||||
div.highlight span.ge { font-style: italic; }
|
||||
div.highlight span.gs { font-weight: bold; }
|
||||
div.highlight span.lnt { color: #999999; user-select: none; }
|
||||
|
||||
/* Page-specific styles set via front matter */
|
||||
{{ with .Scratch.Get "pageCss" }}
|
||||
{{- replace . " !important" "" | safeCSS -}}
|
||||
{{ end }}
|
||||
</style>
|
||||
|
||||
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32") }}
|
||||
{{ partialCached "head/feeds" . }}
|
||||
{{ partialCached "head/webmention" . }}
|
||||
{{ partial "head/schema" . }}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a id="logo" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}">
|
||||
{{ $meImg := resources.Get .Site.Author.image }}
|
||||
{{ $meImgSm := $meImg.Resize "320x320 q90 jpg" }}
|
||||
<amp-img id="selfie" layout="fixed" src="{{ $meImgSm.Permalink }}" width="45" height="45" alt="Photo of Jake Jarvis"></amp-img>
|
||||
|
||||
<span id="name">{{ .Site.Title }}</span>
|
||||
</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="{{ .Site.BaseURL }}" title="Home">🏠</a></li>
|
||||
<li><a href="{{ "notes/" | absURL }}" title="Notes">📝</a></li>
|
||||
<li><a href="mailto:jake@jarv.is" title="Email Me">📬</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
@ -1,11 +1,5 @@
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
|
||||
{{ if and .IsPage (ne .Params.amp false) -}}
|
||||
{{- with .OutputFormats.Get "amp" -}}
|
||||
<link rel="amphtml" href="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
<link rel="author" href="{{ "humans.txt" | absURL }}">
|
||||
<link rel="pgpkey" href="{{ "pubkey.asc" | absURL }}" type="application/pgp-keys">
|
||||
<link rel="license" href="{{ "license/" | absURL }}">
|
||||
|
@ -1,6 +1,5 @@
|
||||
User-Agent: *
|
||||
{{- if eq hugo.Environment "production" }}
|
||||
Allow: /.well-known/amphtml/apikey.pub
|
||||
Disallow: /403.html
|
||||
Disallow: /404.html
|
||||
Disallow: /api/
|
||||
|
@ -1,8 +0,0 @@
|
||||
<amp-iframe
|
||||
layout="responsive"
|
||||
width="1200"
|
||||
height="{{ with .Get "height" }}{{ . }}{{ else }}500{{ end }}"
|
||||
scrolling="no"
|
||||
src="https://codepen.io/{{ .Get "username" }}/embed/{{ .Get "id" }}/?theme-id=light&default-tab={{ .Get "left-tab" }}{{ with .Get "right-tab" }},{{ . }}{{ end }}"
|
||||
sandbox="allow-scripts allow-same-origin allow-popups">
|
||||
</amp-iframe>
|
@ -1 +0,0 @@
|
||||
<p><a href="https://codepen.io/{{ .Get "username" }}/pen/{{ .Get "id" }}" target="_blank" rel="noopener">Open this CodePen in a new window.</a></p>
|
1
layouts/shortcodes/codepen.atom.atom
Symbolic link
1
layouts/shortcodes/codepen.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
codepen.rss.xml
|
@ -1,6 +0,0 @@
|
||||
<amp-facebook
|
||||
width="552"
|
||||
height="310"
|
||||
layout="responsive"
|
||||
data-href="{{ .Get "url" }}">
|
||||
</amp-facebook>
|
@ -1,4 +0,0 @@
|
||||
{{- $url := printf "https://www.facebook.com/plugins/post/oembed.json/?omitscript=1&url=%s" (.Get "url" | urlize) -}}
|
||||
{{- $json := getJSON $url -}}
|
||||
|
||||
{{ $json.html | safeHTML }}
|
1
layouts/shortcodes/facebook.atom.atom
Symbolic link
1
layouts/shortcodes/facebook.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
facebook.rss.xml
|
@ -1,3 +0,0 @@
|
||||
<p class="center">
|
||||
<a href="https://github.com/{{ .Get "username" }}/{{ with .Get "repo" }}{{ . }}{{ end }}" target="_blank" rel="noopener">View on GitHub.</a>
|
||||
</p>
|
@ -1 +0,0 @@
|
||||
<p><a href="https://github.com/{{ .Get "username" }}/{{ .Get "repo" }}">Star {{ .Get "username" }}/{{ .Get "repo" }} on GitHub</a> — <a href="https://github.com/{{ .Get "username" }}/{{ .Get "repo" }}/issues">Issues for {{ .Get "username" }}/{{ .Get "repo" }} on GitHub</a></p>
|
1
layouts/shortcodes/gh-buttons.atom.atom
Symbolic link
1
layouts/shortcodes/gh-buttons.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
gh-buttons.rss.xml
|
@ -1,6 +0,0 @@
|
||||
<amp-gist
|
||||
data-gistid="{{ .Get "id" }}"
|
||||
{{ with .Get "file" }}data-file="{{ . }}"{{ end }}
|
||||
layout="fixed-height"
|
||||
height="500">
|
||||
</amp-gist>
|
@ -1 +0,0 @@
|
||||
<p><a href="https://gist.github.com/{{ .Get "id" }}" target="_blank" rel="noopener">Open this GitHub Gist in a new window.</a></p>
|
1
layouts/shortcodes/gist.atom.atom
Symbolic link
1
layouts/shortcodes/gist.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
gist.rss.xml
|
@ -1,8 +0,0 @@
|
||||
<amp-iframe
|
||||
layout="responsive"
|
||||
src="{{ .Get "src" }}"
|
||||
{{ with .Get "width" }}width="{{ . }}"{{ end }}
|
||||
{{ with .Get "height" }}height="{{ . }}"{{ end }}
|
||||
{{ with .Get "title" }}title="{{ . }}"{{ end }}
|
||||
{{ with .Get "sandbox" }}sandbox="{{ . }}"{{ end }}>
|
||||
</amp-iframe>
|
@ -1 +0,0 @@
|
||||
<p><a href="{{ .Get "src" }}" target="_blank" rel="noopener">Open frame in a new window.</a></p>
|
1
layouts/shortcodes/iframe.atom.atom
Symbolic link
1
layouts/shortcodes/iframe.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
iframe.rss.xml
|
@ -1,16 +0,0 @@
|
||||
{{- $optimized := partial "functions/optimize-image" . -}}
|
||||
|
||||
<p class="image">
|
||||
{{ with .Get "link" }}<a href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
||||
<amp-img
|
||||
{{- with .Get "alt" }} alt="{{ . | safeHTML }}"{{ else }}
|
||||
{{- with .Inner }} alt="{{ . | $.Page.RenderString | plainify | safeHTML }}"{{ end }}{{ end }}
|
||||
src="{{ $optimized.Permalink }}"
|
||||
width="{{ $optimized.Width }}"
|
||||
height="{{ $optimized.Height }}"
|
||||
layout="intrinsic">
|
||||
</amp-img>
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
</p>
|
||||
|
||||
{{ with .Inner }}<p class="caption">{{ . | $.Page.RenderString | safeHTML }}</p>{{ end }}
|
@ -1,10 +0,0 @@
|
||||
{{- $optimized := partial "functions/optimize-image" . -}}
|
||||
|
||||
<p align="center">
|
||||
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
||||
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||
{{- with .Get "alt" }} alt="{{ . | safeHTML }}"{{ end }}
|
||||
{{- with .Inner }} alt="{{ . | $.Page.RenderString | plainify | safeHTML }}"{{ end }}>
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
{{ with .Inner }}<br>{{ . | $.Page.RenderString | safeHTML }}{{ end -}}
|
||||
</p>
|
1
layouts/shortcodes/image.atom.atom
Symbolic link
1
layouts/shortcodes/image.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
image.rss.xml
|
@ -1,7 +0,0 @@
|
||||
<amp-instagram
|
||||
data-shortcode="{{ .Get "id" }}"
|
||||
data-captioned
|
||||
width="500"
|
||||
height="500"
|
||||
layout="responsive">
|
||||
</amp-instagram>
|
@ -1 +0,0 @@
|
||||
<p><a href="https://www.instagram.com/p/{{ .Get "id" }}" target="_blank" rel="noopener">View this image on Instagram.</a></p>
|
1
layouts/shortcodes/instagram.atom.atom
Symbolic link
1
layouts/shortcodes/instagram.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
instagram.rss.xml
|
@ -1,9 +0,0 @@
|
||||
<amp-twitter
|
||||
width="375"
|
||||
height="472"
|
||||
layout="responsive"
|
||||
data-tweetid="{{ index (last 1 (split (index .Params 0) "/")) 0 }}"
|
||||
data-lang="en"
|
||||
data-align="center"
|
||||
data-dnt="true">
|
||||
</amp-twitter>
|
@ -1,4 +0,0 @@
|
||||
{{- $url := printf "https://publish.twitter.com/oembed?lang=en&omit_script=true&dnt=true&align=center&url=%s" (index .Params 0 | safeURL) -}}
|
||||
{{- $json := getJSON $url -}}
|
||||
|
||||
{{ $json.html | safeHTML }}
|
1
layouts/shortcodes/tweet.atom.atom
Symbolic link
1
layouts/shortcodes/tweet.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
tweet.rss.xml
|
@ -1,18 +0,0 @@
|
||||
<amp-video
|
||||
layout="responsive"
|
||||
width="{{ with .Get "width" }}{{ . }}{{ else }}{{ .Site.Params.Theme.maxWidth }}{{ end }}"
|
||||
height="{{ with .Get "height" }}{{ . }}{{ else }}600{{ end }}"
|
||||
{{- with .Page.Resources.GetMatch (.Get "poster") }} poster="{{ .Permalink }}"{{ end }}
|
||||
{{- if .Get "autoplay" }} autoplay{{ end }}
|
||||
{{- if .Get "loop" }} loop{{ end }}
|
||||
{{- if ne (.Get "nocontrols") "1" }} controls{{ end }}>
|
||||
{{ with .Page.Resources.GetMatch (.Get "webm") }}<source src="{{ .Permalink }}" type="video/webm">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch (.Get "mp4") }}<source src="{{ .Permalink }}" type="video/mp4">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch (.Get "ogg") }}<source src="{{ .Permalink }}" type="video/ogg">{{ end }}
|
||||
|
||||
{{ with .Page.Resources.GetMatch (.Get "vtt") }}<track src="{{ .Permalink }}" kind="captions" label="English" srclang="en" default>{{ end }}
|
||||
|
||||
<div fallback>
|
||||
<p>Your browser does not support HTML5 video. {{ with .Page.Resources.GetMatch (.Get "mp4") }}<a href="{{ .Permalink }}">Load the .mp4 video directly.</a>{{ end }}</p>
|
||||
</div>
|
||||
</amp-video>
|
@ -1 +0,0 @@
|
||||
<p>Your browser does not support HTML5 video. {{ with .Page.Resources.GetMatch (.Get "mp4") }}<a href="{{ .Permalink }}">Click to open the .mp4 video directly.</a>{{ end }}</p>
|
1
layouts/shortcodes/video.atom.atom
Symbolic link
1
layouts/shortcodes/video.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
video.rss.xml
|
@ -1,6 +0,0 @@
|
||||
<amp-vimeo
|
||||
data-videoid="{{ .Get "id" }}"
|
||||
layout="responsive"
|
||||
width="500"
|
||||
height="281">
|
||||
</amp-vimeo>
|
@ -1 +0,0 @@
|
||||
<p><a href="https://vimeo.com/{{ .Get "id" }}" target="_blank" rel="noopener">Watch this video on Vimeo.</a></p>
|
1
layouts/shortcodes/vimeo.atom.atom
Symbolic link
1
layouts/shortcodes/vimeo.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
vimeo.rss.xml
|
@ -1,8 +0,0 @@
|
||||
<p class="center">
|
||||
<amp-youtube
|
||||
data-videoid="{{ index .Params 0 }}"
|
||||
layout="responsive"
|
||||
width="480"
|
||||
height="270">
|
||||
</amp-youtube>
|
||||
</p>
|
@ -1 +0,0 @@
|
||||
<p><a href="https://www.youtube.com/watch?v={{ index .Params 0 }}" target="_blank" rel="noopener">Watch this video on YouTube.</a></p>
|
1
layouts/shortcodes/youtube.atom.atom
Symbolic link
1
layouts/shortcodes/youtube.atom.atom
Symbolic link
@ -0,0 +1 @@
|
||||
youtube.rss.xml
|
25
netlify.toml
25
netlify.toml
@ -7,7 +7,6 @@
|
||||
NODE_VERSION = "14"
|
||||
YARN_VERSION = "1.22.10"
|
||||
YARN_FLAGS = "--no-ignore-optional --frozen-lockfile"
|
||||
PYTHON_VERSION = "3.7"
|
||||
|
||||
# Ensure *only* Pretty URLs are enabled, even though this is already set up in
|
||||
# the Netlify dashboard.
|
||||
@ -44,15 +43,10 @@
|
||||
# Enable local Netlify build plugins:
|
||||
[[plugins]]
|
||||
package = "@netlify/plugin-local-install-core"
|
||||
# Optimize AMP pages server-side:
|
||||
# https://github.com/ampproject/amp-toolbox/tree/master/packages/optimizer
|
||||
# https://github.com/martinbean/netlify-plugin-amp-server-side-rendering
|
||||
[[plugins]]
|
||||
package = "./plugins/netlify-plugin-amp-optimizer"
|
||||
# Cache resoures between builds:
|
||||
# https://github.com/jakejarvis/netlify-plugin-cache
|
||||
[[plugins]]
|
||||
package = "./plugins/netlify-plugin-cache"
|
||||
package = "netlify-plugin-cache"
|
||||
[plugins.inputs]
|
||||
paths = ["public", "builds", "_vendor"]
|
||||
# List cached resources for debugging:
|
||||
@ -67,21 +61,20 @@
|
||||
[[headers]]
|
||||
for = "/*"
|
||||
[headers.values]
|
||||
# https://amp.dev/documentation/guides-and-tutorials/optimize-and-measure/secure-pages/
|
||||
Content-Security-Policy = '''
|
||||
default-src 'self';
|
||||
base-uri 'none';
|
||||
connect-src 'self' *.ampproject.net csp-collector.appspot.com/csp/amp api.github.com platform.twitter.com;
|
||||
font-src 'self' fonts.googleapis.com fonts.gstatic.com;
|
||||
connect-src 'self' api.github.com platform.twitter.com;
|
||||
font-src 'self';
|
||||
form-action 'none';
|
||||
frame-ancestors 'self';
|
||||
frame-src 'self' jakejarvis.github.io *.ampproject.net cdn.ampproject.org app.usefathom.com buttons.github.io codepen.io cdpn.io platform.twitter.com player.vimeo.com www.youtube-nocookie.com;
|
||||
frame-src 'self' jakejarvis.github.io buttons.github.io codepen.io cdpn.io platform.twitter.com www.youtube-nocookie.com;
|
||||
img-src 'self' data: https:;
|
||||
manifest-src 'self';
|
||||
media-src 'self' data: https:;
|
||||
object-src 'none';
|
||||
script-src 'self' cdn.ampproject.org/lts/v0.js cdn.ampproject.org/lts/v0.mjs cdn.ampproject.org/lts/v0/ cdn.ampproject.org/viewer/ cdn.ampproject.org/rtv/ 3p.ampproject.net buttons.github.io gist.github.com syndication.twitter.com platform.twitter.com player.vimeo.com 'sha256-1j1MKfE70TTCp5KmiC2YImxw2RMS52uCH5yXl1heG9U=' 'sha256-y3Xr/40/KQnUvqk/kZO5us6t3i/I49BsbYjsH8ELhVg=' 'sha256-JGG0npUp+0ABq/NY1azjpQ0WBtm+m5gU58mzF+2DCXY=';
|
||||
style-src 'self' 'unsafe-inline' cdn.ampproject.org/rtv/ fonts.googleapis.com assets-cdn.github.com github.githubassets.com;
|
||||
script-src 'self' buttons.github.io gist.github.com syndication.twitter.com platform.twitter.com 'sha256-1j1MKfE70TTCp5KmiC2YImxw2RMS52uCH5yXl1heG9U=' 'sha256-y3Xr/40/KQnUvqk/kZO5us6t3i/I49BsbYjsH8ELhVg=' 'sha256-JGG0npUp+0ABq/NY1azjpQ0WBtm+m5gU58mzF+2DCXY=';
|
||||
style-src 'self' 'unsafe-inline' github.githubassets.com;
|
||||
worker-src 'self';
|
||||
block-all-mixed-content;
|
||||
report-uri https://jarv.is/api/csp_wizard;
|
||||
@ -137,12 +130,6 @@
|
||||
to = "https://jarvis.report-uri.com/r/d/csp/enforce"
|
||||
status = 200
|
||||
force = true
|
||||
## Fathom Analytics endpoint
|
||||
[[redirects]]
|
||||
from = "/api/count_view*"
|
||||
to = "https://starman.fathomdns.com/:splat"
|
||||
status = 200
|
||||
force = true
|
||||
## Webmention.io endpoints
|
||||
[[redirects]]
|
||||
from = "/api/mention"
|
||||
|
@ -61,6 +61,7 @@
|
||||
"lint-staged": "^11.0.0",
|
||||
"markdownlint-cli": "~0.27.1",
|
||||
"netlify-lambda": "^2.0.8",
|
||||
"netlify-plugin-cache": "^1.0.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.3.0",
|
||||
"postcss-clean": "jakejarvis/postcss-clean#master",
|
||||
|
@ -1,3 +0,0 @@
|
||||
node_modules/
|
||||
package-lock.json
|
||||
npm-debug.log*
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Martin Bean
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,3 +0,0 @@
|
||||
# Netlify Plugin: AMP Optimizer
|
||||
|
||||
Lightly modified from [martinbean/netlify-plugin-amp-server-side-rendering](https://github.com/martinbean/netlify-plugin-amp-server-side-rendering).
|
@ -1,37 +0,0 @@
|
||||
const ampOptimizer = require('@ampproject/toolbox-optimizer').create({
|
||||
verbose: true,
|
||||
lts: true,
|
||||
minify: true,
|
||||
autoExtensionImport: true,
|
||||
blurredPlaceholders: true,
|
||||
imageBasePath: './images'
|
||||
})
|
||||
const fs = require('fs')
|
||||
const glob = require('glob')
|
||||
|
||||
module.exports = {
|
||||
onPostBuild: async ({ constants, utils }) => {
|
||||
// Hugo renders my AMP pages as amp.html right next to each page's index.html
|
||||
const pattern = constants.PUBLISH_DIR + '/**/amp.html'
|
||||
|
||||
const files = await new Promise((resolve, reject) => {
|
||||
glob(pattern, { nodir: true }, (error, files) => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
error ? reject(error) : resolve(files)
|
||||
})
|
||||
})
|
||||
|
||||
await Promise.all(
|
||||
files.map(async file => {
|
||||
const html = await fs.promises.readFile(file, 'utf-8')
|
||||
const optimizedHtml = await ampOptimizer.transformHtml(html)
|
||||
await fs.promises.writeFile(file, optimizedHtml)
|
||||
})
|
||||
)
|
||||
|
||||
utils.status.show({
|
||||
title: `${files.length} AMP pages optimized`,
|
||||
summary: 'Great success! ⚡'
|
||||
})
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
name: netlify-plugin-amp-optimizer
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "netlify-plugin-amp-optimizer",
|
||||
"version": "1.0.0",
|
||||
"description": "Render your AMP pages, server-side.",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Martin Bean",
|
||||
"url": "https://martinbean.dev"
|
||||
},
|
||||
"files": [
|
||||
"manifest.yml",
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@ampproject/toolbox-optimizer": "^2.8.0",
|
||||
"@ampproject/toolbox-update-cache": "^2.8.0",
|
||||
"cssnano-simple": "^2.0.0",
|
||||
"glob": "^7.1.7",
|
||||
"jimp": "^0.16.1",
|
||||
"lru-cache": "^6.0.0",
|
||||
"postcss": "^8.x",
|
||||
"postcss-safe-parser": "^5.0.2",
|
||||
"probe-image-size": "^7.1.1",
|
||||
"terser": "^5.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.18"
|
||||
}
|
||||
}
|
3
plugins/netlify-plugin-cache/.gitignore
vendored
3
plugins/netlify-plugin-cache/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
node_modules/
|
||||
package-lock.json
|
||||
npm-debug.log*
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Jake Jarvis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,48 +0,0 @@
|
||||
# ⚡ Netlify Plugin: Custom Cache [](https://www.npmjs.com/package/netlify-plugin-cache) 
|
||||
|
||||
A generic cache plugin for saving and restoring files and/or folders between Netlify builds for impressive speed improvements. Worry less about running out of build minutes! ⏰
|
||||
|
||||
Essentially, this plugin is a pretty wrapper around [Netlify's native cache utility](https://github.com/netlify/build/blob/master/packages/cache-utils/README.md) — it isn't tied to any specific static site generator (on purpose).
|
||||
|
||||
## 💿 Install
|
||||
|
||||
Add the following lines to your `netlify.toml`:
|
||||
|
||||
```toml
|
||||
[[plugins]]
|
||||
package = "netlify-plugin-cache"
|
||||
[plugins.inputs]
|
||||
# Optional (but highly recommended). Defaults to [".cache"].
|
||||
paths = ["resources", "_vendor", "folder/file.md"]
|
||||
```
|
||||
|
||||
This plugin only takes one input named `paths`: an array of files and/or directories relative to your project's root. These files/directories are restored before a build and saved in cache after a build **if it is successful**.
|
||||
|
||||
**🚨 Important:** `paths` defaults to `[".cache"]`, but it's **highly recommended** you set this yourself based on the tool(s) you're using to generate your site. See examples below.
|
||||
|
||||
Read more about plugin configuration at [the official Netlify Plugin docs](https://docs.netlify.com/configure-builds/build-plugins/#install-a-plugin).
|
||||
|
||||
## 👩💻 Usage
|
||||
|
||||
- **Hugo:** Caching the `resources` directory can speed up your build greatly if you [process](https://gohugo.io/content-management/image-processing/) a lot of images, or compile SASS/SCSS via Hugo pipes. You can also cache the `public` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://gohugo.io/getting-started/directory-structure/#directory-structure-explained)
|
||||
- **Gatsby:** By default, the `.cache` directory holds persistent data between builds. You can also cache the `dist` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://www.gatsbyjs.org/docs/build-caching/)
|
||||
- **Jekyll:** A caching API was added as of v4. The notoriously slow SSG can become (relatively) faster by caching the `.jekyll-cache` directory. [More info here.](https://jekyllrb.com/tutorials/cache-api/)
|
||||
- **Next.js:** The `.next` directory holds the build output. [More info here.](https://nextjs.org/docs/api-reference/next.config.js/setting-a-custom-build-directory)
|
||||
- **Anything else:** This is the reason I kept this plugin as generic as possible! Research the caching behavior of your static site generator (and how to customize it if necessary). Feel free to open a PR and list it here as well!
|
||||
|
||||
## 🐛 Debugging
|
||||
|
||||
This plugin doesn't provide a way to output a list of files that were cached or restored, because Netlify already provides an official plugin named [`netlify-plugin-debug-cache`](https://github.com/netlify-labs/netlify-plugin-debug-cache) to do exactly that. No need to re-invent the wheel!
|
||||
|
||||
You can add the debug plugin **after** this plugin in your `netlify.toml`. (And yes, you need a `[[plugins]]` line for _each_ plugin you add.)
|
||||
|
||||
```toml
|
||||
[[plugins]]
|
||||
package = "netlify-plugin-debug-cache"
|
||||
```
|
||||
|
||||
The debug plugin will generate a file named `cache-output.json` at the root of your project's publish directory. [See an example file](https://infallible-wing-581e78.netlify.app/cache-output.json) or [learn more about this plugin](https://github.com/netlify-labs/netlify-plugin-debug-cache).
|
||||
|
||||
## 📜 License
|
||||
|
||||
This project is distributed under the [MIT license](LICENSE).
|
@ -1,37 +0,0 @@
|
||||
// Netlify Plugin: netlify-plugin-cache
|
||||
// https://github.com/jakejarvis/netlify-plugin-cache
|
||||
//
|
||||
// This plugin is essentially a wrapper around Netlify's native `cache-utils`:
|
||||
// https://github.com/netlify/build/blob/master/packages/cache-utils/README.md
|
||||
|
||||
module.exports = {
|
||||
// Try to restore cache before build begins, if it exists
|
||||
onPreBuild: async ({ utils: { cache }, inputs }) => {
|
||||
if (await cache.restore(inputs.paths)) {
|
||||
const files = await cache.list(inputs.paths);
|
||||
console.log(`Successfully restored: ${inputs.paths.join(", ")} ... ${files.length} files in total.`);
|
||||
} else {
|
||||
console.log(`A cache of '${inputs.paths.join(", ")}' doesn't exist (yet).`);
|
||||
}
|
||||
},
|
||||
|
||||
// Only save/update cache if build was successful
|
||||
onSuccess: async ({ utils: { cache, status }, inputs }) => {
|
||||
if (await cache.save(inputs.paths)) {
|
||||
const files = await cache.list(inputs.paths);
|
||||
console.log(`Successfully cached: ${inputs.paths.join(", ")} ... ${files.length} files in total.`);
|
||||
|
||||
// Show success & more detail in deploy summary
|
||||
status.show({
|
||||
title: `${files.length} files cached`,
|
||||
summary: "These will be restored on the next build! ⚡",
|
||||
text: `${inputs.paths.join(", ")}`,
|
||||
});
|
||||
} else {
|
||||
// This probably happened because the default `paths` is set, so provide instructions to fix
|
||||
console.log(`Attempted to cache: ${inputs.paths.join(", ")} ... but failed. :(`);
|
||||
console.log("Try setting the 'paths' input appropriately in your netlify.toml configuration.");
|
||||
console.log("More details: https://jrvs.io/netlify-cache-usage");
|
||||
}
|
||||
},
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
name: netlify-plugin-cache
|
||||
inputs:
|
||||
- name: paths
|
||||
description: Array of files and/or directories to cache between builds.
|
||||
default: [".cache"]
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "netlify-plugin-cache",
|
||||
"version": "1.0.3",
|
||||
"description": "Generic cache plugin for saving and restoring files and/or folders between Netlify builds",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Jake Jarvis",
|
||||
"email": "jake@jarv.is",
|
||||
"url": "http://jarv.is/"
|
||||
},
|
||||
"homepage": "https://github.com/jakejarvis/netlify-plugin-cache#readme",
|
||||
"bugs": "https://github.com/jakejarvis/netlify-plugin-cache/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jakejarvis/netlify-plugin-cache.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=10.18"
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fonttools[lxml,ufo,unicode,woff]==4.24.4
|
||||
Brotli==1.0.9
|
||||
zopfli==0.1.8
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
@ -1,9 +0,0 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1upnHtc/v97NGGvSFiJ6
|
||||
Krddk+u62ZiZiNjU+urVfBYNZe4H+SDgfmSwi/AEpa3C5O9U0bInGlNJUvL5FYNo
|
||||
Wjrg8/ZFZ0mkGwe9GqCw/ipeYBiBovIPoWpoHLts5KRLMGro4/gWfivcYFi9+gm8
|
||||
x4rbGOgMdQf+p86vxMlo/waeKD3YV1+YOqJDTGib0e9JqZH/RavRPwcp+1kMExYv
|
||||
DHvpcBnZdg16663mjGGiG4IPS3KzwL7cXxryywPmt/yg/fSh63h2W5MMOKoevjr0
|
||||
oZbUNEEjepvuYq0aAcK3Ce33cSKgkHv67Ir/3TDgfAi4l4VgIZm0JZd2W5OwvcvN
|
||||
/QIDAQAB
|
||||
-----END PUBLIC KEY-----
|
33
yarn.lock
33
yarn.lock
@ -1952,9 +1952,9 @@ caniuse-api@^3.0.0:
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001166, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001230:
|
||||
version "1.0.30001231"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001231.tgz#6c1f9b49fc27cc368b894e64b9b28b39ef80603b"
|
||||
integrity sha512-WAFFv31GgU4DiwNAy77qMo3nNyycEhH3ikcCVHvkQpPe/fO8Tb2aRYzss8kgyLQBm8mJ7OryW4X6Y4vsBCIqag==
|
||||
version "1.0.30001232"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001232.tgz#2ebc8b6a77656fd772ab44a82a332a26a17e9527"
|
||||
integrity sha512-e4Gyp7P8vqC2qV2iHA+cJNf/yqUKOShXQOJHQt81OHxlIZl/j/j3soEA0adAQi8CPUQgvOdDENyQ5kd6a6mNSg==
|
||||
|
||||
caw@^2.0.0, caw@^2.0.1:
|
||||
version "2.0.1"
|
||||
@ -2901,9 +2901,9 @@ ee-first@1.1.1:
|
||||
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
|
||||
|
||||
electron-to-chromium@^1.3.723:
|
||||
version "1.3.742"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.742.tgz#7223215acbbd3a5284962ebcb6df85d88b95f200"
|
||||
integrity sha512-ihL14knI9FikJmH2XUIDdZFWJxvr14rPSdOhJ7PpS27xbz8qmaRwCwyg/bmFwjWKmWK9QyamiCZVCvXm5CH//Q==
|
||||
version "1.3.743"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.743.tgz#fcec24d6d647cb84fd796b42caa1b4039a180894"
|
||||
integrity sha512-K2wXfo9iZQzNJNx67+Pld0DRF+9bYinj62gXCdgPhcu1vidwVuLPHQPPFnCdO55njWigXXpfBiT90jGUPbw8Zg==
|
||||
|
||||
elliptic@^6.5.3:
|
||||
version "6.5.4"
|
||||
@ -3666,10 +3666,10 @@ for-in@^1.0.2:
|
||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
||||
integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=
|
||||
|
||||
forwarded@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
|
||||
integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=
|
||||
forwarded@0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
||||
integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==
|
||||
|
||||
fraction.js@^4.1.1:
|
||||
version "4.1.1"
|
||||
@ -5804,6 +5804,11 @@ netlify-lambda@^2.0.8:
|
||||
webpack "^4.43.0"
|
||||
webpack-merge "^4.2.2"
|
||||
|
||||
netlify-plugin-cache@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.3.tgz#f60514e259dff2b3286b6d60b570bb1c81206794"
|
||||
integrity sha512-CTOwNWrTOP59T6y6unxQNnp1WX702v2R/faR5peSH94ebrYfyY4zT5IsRcIiHKq57jXeyCrhy0GLuTN8ktzuQg==
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
||||
@ -6731,11 +6736,11 @@ proto-list@~1.2.1:
|
||||
integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
|
||||
|
||||
proxy-addr@~2.0.5:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"
|
||||
integrity sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==
|
||||
version "2.0.7"
|
||||
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025"
|
||||
integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==
|
||||
dependencies:
|
||||
forwarded "~0.1.2"
|
||||
forwarded "0.2.0"
|
||||
ipaddr.js "1.9.1"
|
||||
|
||||
prr@~1.0.1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user