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:
13
layouts/partials/functions/webpack.html
Normal file
13
layouts/partials/functions/webpack.html
Normal 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 }}
|
||||
Reference in New Issue
Block a user