mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
chore(link.html): update critical style source and options to improve performance and maintainability
chore(link.html): update main style source and options to improve performance and maintainability chore(link.html): remove unused meta.html file chore(nav.html): update decrement and increment buttons to use Unicode characters for better accessibility chore(plugin/style.html): update style plugin to support inline styles for critical CSS chore(plugin/style.html): update style plugin to support minification and fingerprinting for main CSS chore(plugin/style.html): remove script plugin as it is no longer used chore(plugin/style.html): update style plugin to support inline styles for critical CSS chore(plugin/style.html): update style plugin to support minification and fingerprinting for main CSS chore(resources/imageJSON.html): update image resize options for better performance and quality
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
{{/* fingerprint */}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" | default "" -}}
|
||||
|
||||
{{/* main style */}}
|
||||
{{- $style := dict "Source" "scss/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.css" "enableSourceMap" true -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options "Minify" hugo.IsProduction | merge $style -}}
|
||||
{{/* critical style */}}
|
||||
{{- $style := dict "Source" "scss/critical.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "enableSourceMap" true "includePaths" (slice "node_modules") -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options "Inline" true | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{/* main style */}}
|
||||
{{- $style := dict "Source" "scss/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.css" "enableSourceMap" true "includePaths" (slice "node_modules") -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options "Minify" hugo.IsProduction "Defer" true | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{/* main js */}}
|
||||
{{- $esBuildOpts := dict "minify" hugo.IsProduction "targetPath" "js/main.js" -}}
|
||||
{{- $script := dict "Source" "ts/main.ts" "Fingerprint" $fingerprint "Defer" true -}}
|
||||
{{- $script = dict "ToESBuild" $esBuildOpts "Minify" hugo.IsProduction | merge $script -}}
|
||||
{{- partial "plugin/script.html" $script -}}
|
||||
<script type="module" src="js/main.js" defer></script>
|
||||
|
||||
{{/* fonts */}}
|
||||
<link
|
||||
rel="preload"
|
||||
href="/lib/fonts/HelveticaNowText-Regular.woff2"
|
||||
href="/lib/fonts/GeistVF.woff2"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
crossorigin
|
||||
/>
|
||||
<link rel="preload" href="/lib/fonts/fw.svg" as="font" type="font/svg" crossorigin />
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<div class="threshold">
|
||||
<span>Threshold:</span>
|
||||
<span>
|
||||
<button class="dec">-</button>
|
||||
<button class="dec">-</button>
|
||||
<span class="num"></span><span class="num"></span><span class="num"></span
|
||||
><span class="num"></span>
|
||||
<button class="inc">+</button>
|
||||
<button class="inc">+</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="index">
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
{{- if .Content -}}
|
||||
<script type="text/javascript">
|
||||
{{- .Content | safeJS -}}
|
||||
</script>
|
||||
{{- else if strings.HasPrefix .Source "<script" -}}
|
||||
{{- safeHTML .Source -}}
|
||||
{{- else -}}
|
||||
{{- $src := .Source -}}
|
||||
{{- $integrity := .Integrity -}}
|
||||
{{- if $src -}}
|
||||
{{- if (urls.Parse $src).Host | not -}}
|
||||
{{- $resource := resources.Get $src -}}
|
||||
{{- with .Template -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
|
||||
{{- end -}}
|
||||
{{- with .ToESBuild -}}
|
||||
{{- $resource = $resource | js.Build . -}}
|
||||
{{- end -}}
|
||||
{{- if .Minify -}}
|
||||
{{- $resource = $resource | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .Fingerprint -}}
|
||||
{{- $resource = $resource | fingerprint . -}}
|
||||
{{- $integrity = $resource.Data.Integrity -}}
|
||||
{{- end -}}
|
||||
{{- $src = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Link -}}
|
||||
{{- $src = . -}}
|
||||
{{- end -}}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $src }}"
|
||||
{{ if .Crossorigin }}crossorigin="anonymous"{{ end }}{{ with $integrity }}
|
||||
integrity="{{ . }}"
|
||||
{{ end }}{{ if .Async }}async{{ end }}{{ if .Defer }}defer{{ end }}{{ with .Attr }}
|
||||
{{ . | safeHTMLAttr }}
|
||||
{{ end }}
|
||||
></script>
|
||||
{{- end -}}
|
||||
@@ -18,7 +18,7 @@
|
||||
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
|
||||
{{- $resource = $resource | toCSS $options -}}
|
||||
{{- end -}}
|
||||
{{- if .Minify -}}
|
||||
{{- if or .Minify .Inline -}}
|
||||
{{- $resource = $resource | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .Fingerprint -}}
|
||||
@@ -27,7 +27,9 @@
|
||||
{{- end -}}
|
||||
{{- $href = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- if .Defer -}}
|
||||
{{- if .Inline -}}
|
||||
<style>{{- $resource.Content | safeCSS -}}</style>
|
||||
{{- else if .Defer -}}
|
||||
<link
|
||||
rel="preload"
|
||||
as="style"
|
||||
@@ -55,4 +57,3 @@
|
||||
/>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{{ $Page.Scratch.Add "img" slice }}
|
||||
{{ range . }}
|
||||
{{ $index = sub $index 1 }}
|
||||
{{ $lores := .Resize "1000x webp Lanczos q70" }}
|
||||
{{ $lores := .Resize "800x webp Lanczos q60" }}
|
||||
{{ $hires := .Resize "2500x webp Lanczos q75" }}
|
||||
{{ $Page.Scratch.Add "img" (dict
|
||||
"index" (int $index)
|
||||
|
||||
Reference in New Issue
Block a user