1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-12-03 04:18:57 -05:00

add a partial template that returns an asset's URL and hash from webpack's manifest

still a mess but slightly more modular. also added a real 404 page.
This commit is contained in:
2021-09-03 11:16:27 -04:00
parent a304fa5079
commit 3a3849e8ec
13 changed files with 97 additions and 111 deletions

View File

@@ -0,0 +1,13 @@
{{/* Returns the URL and hash of an asset processed by Webpack */}}
{{/* Usage: pass in (dict "context" . "src" "images/tiny-selfie.jpg"), returns .src = "/assets/images/tiny-selfie.jpg", .integrity = "sha384-asdfjklsemicolon" */}}
{{ $src := .src }}
{{ $data := "" }}
{{ with .context.Site.Data.manifest }}
{{ with index . $src }}
{{ $data = . }}
{{ end }}
{{ end }}
{{ return $data }}