mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
feat(link.html): add support for deferred loading and ES modules for main style and js files
This commit is contained in:
@@ -9,15 +9,9 @@
|
||||
|
||||
{{/* main style */}}
|
||||
{{- if site.Params.bundled -}}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
href="/bundled/css/style.min.css"
|
||||
/>
|
||||
<noscript><link rel="stylesheet" href="/bundled/css/style.min.css" /></noscript>
|
||||
{{- $style := dict "Link" "/bundled/css/style.min.css" "Defer" true -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
{{- else -}}
|
||||
{{- $style := dict "Source" "scss/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $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 -}}
|
||||
@@ -25,7 +19,8 @@
|
||||
{{- end -}}
|
||||
|
||||
{{/* main js */}}
|
||||
<script type="module" src="/bundled/js/main.js" defer></script>
|
||||
{{- $script := dict "Link" "/bundled/js/main.js" "Defer" true "Esm" true -}}
|
||||
{{- partial "plugin/script.html" $script -}}
|
||||
|
||||
{{/* fonts */}}
|
||||
<link rel="preload" href="/lib/fonts/NotoSans-Regular.woff2" as="font" crossorigin />
|
||||
|
||||
Reference in New Issue
Block a user