diff options
author | tdro <tdro@noreply.example.com> | 2022-05-06 10:02:34 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-05-06 10:02:34 -0400 |
commit | b6fe81acbf8ba0032ece1a98f0b34f02a198cfbf (patch) | |
tree | 83d69888d7951a977311a044a2a31251589c83de /themes | |
parent | 6caee9fe72293ef957bb9461e489d85f65edbc41 (diff) | |
download | canory-b6fe81acbf8ba0032ece1a98f0b34f02a198cfbf.tar.gz canory-b6fe81acbf8ba0032ece1a98f0b34f02a198cfbf.tar.bz2 canory-b6fe81acbf8ba0032ece1a98f0b34f02a198cfbf.zip |
static: Remove asset duplication
Move bundles up the fold.
Diffstat (limited to 'themes')
-rw-r--r-- | themes/default/layouts/partials/head.html | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/themes/default/layouts/partials/head.html b/themes/default/layouts/partials/head.html index fd04ed0..37a89e6 100644 --- a/themes/default/layouts/partials/head.html +++ b/themes/default/layouts/partials/head.html @@ -29,33 +29,32 @@ <meta name="twitter:description" content="{{- partial "site-description.html" . -}}"> <meta name="twitter:image" content="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.png"> -<!-- Progressive Enhancement --> -{{- partial "manifest.html" . -}} - -<!-- Content Security Policy --> -{{- partial "csp.html" . -}} - <!-- Style Sheets & Scripts --> -{{- if .Site.Params.production -}} - +{{- $index := resources.Get "js/index.js" -}} {{- $default := resources.Get "css/default.css" -}} {{- $syntax := resources.Get "css/syntax-highlight-default.css" -}} -{{ $css := slice $default $syntax | resources.Concat "css/bundle.css" | resources.Minify | fingerprint }} + +{{- $js := $index | resources.Minify | fingerprint -}} +{{- $css := slice $default $syntax | resources.Concat "css/bundle.css" | resources.Minify | fingerprint -}} + +{{ if .Site.Params.production }} <link rel="stylesheet" href="{{ $css.Permalink }}"> -{{ $js := resources.Get "js/index.js" | resources.Minify | fingerprint }} <script src="{{ $js.Permalink }}"></script> - {{ else }} +<link rel="stylesheet" href="{{ $default.Permalink }}"> +<link rel="stylesheet" href="{{ $syntax.Permalink }}"> +<script src="{{ $index.Permalink }}"></script> +{{ end }} -<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/default.css"> -<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/syntax-highlight-default.css"> -<script src="{{ .Site.BaseURL }}/js/index.js"></script> +<!-- Progressive Enhancement --> +{{- partial "manifest.html" . -}} -{{- end -}} +<!-- Content Security Policy --> +{{- partial "csp.html" . -}} <!-- No Scripts --> <noscript> <style> - {{ safeCSS (readFile "static/css/noscript.css") }} + {{ safeCSS (readFile "assets/css/noscript.css") }} </style> </noscript> |