Added hash to resource filenames

Cache busting is here wooooo
This commit is contained in:
Alejandro Angulo 2021-10-03 10:42:07 -07:00
parent 8d2abf9b3b
commit b1790c7776
No known key found for this signature in database
GPG key ID: A8B58A203A659A98
10 changed files with 63 additions and 11 deletions

View file

@ -21,3 +21,6 @@ repos:
rev: v2.4.1 rev: v2.4.1
hooks: hooks:
- id: prettier - id: prettier
additional_dependencies:
- prettier@2.4.1
- prettier-plugin-go-template@0.0.11

10
.prettierrc Normal file
View file

@ -0,0 +1,10 @@
{
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template"
}
}
]
}

View file

@ -1 +0,0 @@
{}

View file

@ -3,6 +3,7 @@
"packageManager": "yarn@3.0.2", "packageManager": "yarn@3.0.2",
"devDependencies": { "devDependencies": {
"eslint": "^7.32.0", "eslint": "^7.32.0",
"prettier": "^2.4.1" "prettier": "^2.4.1",
"prettier-plugin-go-template": "^0.0.11"
} }
} }

View file

@ -1 +1,4 @@
<script src="/js/keynav.js"></script> {{ $keynav := resources.Get "js/keynav.js" | minify | fingerprint }}<script
src="{{ $keynav.Permalink }}"
integrity="{{ $keynav.Data.Integrity }}"
></script>

View file

@ -1,10 +1,25 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/hack-font/3.3.0/web/hack.min.css"> <link
<link rel="stylesheet" type="text/css" href="/css/style.css"> rel="stylesheet"
<link rel="stylesheet" type="text/css" href="/css/highlight.css"> type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/hack-font/3.3.0/web/hack.min.css"
/>
{{ $main_style := resources.Get "css/main.css" | minify }}
{{ $highlight_style := resources.Get "css/highlight.css" | minify }}
{{ $css := slice $main_style $highlight_style | resources.Concat "css/style.css" | fingerprint }}
<link
rel="stylesheet"
type="text/css"
href="{{ $css.Permalink }}"
integrity="{{ $css.Data.Integrity }}"
/>
{{ $title := print .Site.Title " | " .Title }} {{ $title := print .Site.Title " | " .Title }}
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }} {{ if .IsHome }}
{{ $title =
.Site.Title
}}
{{ end }}
<title>{{ $title }}</title> <title>{{ $title }}</title>
</head> </head>

View file

@ -115,6 +115,7 @@ __metadata:
dependencies: dependencies:
eslint: ^7.32.0 eslint: ^7.32.0
prettier: ^2.4.1 prettier: ^2.4.1
prettier-plugin-go-template: ^0.0.11
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -796,6 +797,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"prettier-plugin-go-template@npm:^0.0.11":
version: 0.0.11
resolution: "prettier-plugin-go-template@npm:0.0.11"
dependencies:
ulid: ^2.3.0
peerDependencies:
prettier: ^2.0.0
checksum: 0c78d4f096d86d52fa40c11c81c4ab4b9d39732eb990fb5cb88bd2a43aefadf131d73d39f408446a805348117b5c69b441093e491ac175def86f83e38c7742ea
languageName: node
linkType: hard
"prettier@npm:^2.4.1": "prettier@npm:^2.4.1":
version: 2.4.1 version: 2.4.1
resolution: "prettier@npm:2.4.1" resolution: "prettier@npm:2.4.1"
@ -978,6 +990,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ulid@npm:^2.3.0":
version: 2.3.0
resolution: "ulid@npm:2.3.0"
bin:
ulid: ./bin/cli.js
checksum: d6dbf253fdc189f60fe2829d934ee5447b3dab62d05449a2e0fe89670d77087dd6eba4f844a69f9ffdb01384ec6fd97bdd9be638fc67d593569a45e8969f1e69
languageName: node
linkType: hard
"uri-js@npm:^4.2.2": "uri-js@npm:^4.2.2":
version: 4.4.1 version: 4.4.1
resolution: "uri-js@npm:4.4.1" resolution: "uri-js@npm:4.4.1"