Browse Source

Making base layout asset linking a little cleaner

master
Mobius K 2 years ago
parent
commit
221f2b2f94
  1. 20
      layouts/_default/baseof.html

20
layouts/_default/baseof.html

@ -14,24 +14,36 @@
<link rel="shortcut icon" href="/favicon.ico">
<!-- Parse styles -->
{{ $scss := resources.Get "index.scss" }}
{{ $style := $scss | toCSS $.Site.Params.scss }}
{{ $ts := resources.Get "index.ts" }}
{{ $tsTranspiled := $ts | babel }}
{{ $script := $tsTranspiled | js.Build $.Site.Params.ts }}
<!-- Parse scripts -->
{{ $script := resources.Get "index.ts" }}
{{ $sentry := resources.Get "sentry.ts" }}
{{ with $.Site.Params.ts }}
{{ $script = $script | babel | js.Build . }}
{{ $sentry = $sentry | babel | js.Build . }}
{{ end }}
<!-- Fingerprint assets -->
{{ if $.Site.Params.fingerprint.enabled }}
{{ with $.Site.Params.fingerprint.algorithm }}
{{ $style = $style | fingerprint . }}
{{ $script = $script | fingerprint . }}
{{ $sentry = $sentry | fingerprint . }}
{{ end }}
{{ end }}
<!-- Link assets -->
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ if $.Site.Params.sentry }}
{{ $sentry := resources.Get "sentry.ts" | babel | js.Build $.Site.Params.ts | fingerprint "md5" }}
<script src="{{ $sentry.RelPermalink }}" defer></script>
{{ end }}

Loading…
Cancel
Save