2023-09-27 11:58:05

This commit is contained in:
z17CX 2023-09-27 11:58:05 +00:00
parent 1d5d0b45c3
commit c13ae94c72
Signed by: z17cx
GPG key ID: 3F5F87C84EE943E4
4 changed files with 54 additions and 4 deletions

View file

@ -109,6 +109,20 @@ node:
enabled: 1
file:
enabled: 1
# -------------------------------------------------------------------------------------------------------------------- #
# Highlight.js.
# -------------------------------------------------------------------------------------------------------------------- #
highlight:
styles:
external:
- 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/styles/agate.min.css'
internal:
scripts:
external:
- 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js'
internal:
```
## Functions

View file

@ -48,7 +48,6 @@ styles:
- 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css'
- 'https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css'
- 'https://cdn.jsdelivr.net/npm/@fancyapps/ui@5/dist/fancybox/fancybox.css'
- 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/styles/agate.min.css'
internal:
system:
internal:
@ -65,7 +64,6 @@ scripts:
- 'https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.min.js'
- 'https://cdn.jsdelivr.net/npm/@fancyapps/ui@5/dist/fancybox/fancybox.umd.js'
- 'https://cdn.jsdelivr.net/npm/headroom.js/dist/headroom.min.js'
- 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js'
- 'https://cdn.jsdelivr.net/npm/easyqrcodejs@4/dist/easy.qrcode.min.js'
internal:
system:

View file

@ -1,4 +1,5 @@
{{ $styles := (($.Site.Data.ui.styles) | default slice) }}
{{ $styles := ($.Site.Data.ui.styles) }}
{{ $hljs := ($.Site.Params.highlight.styles) }}
<!--[ vendor-external ]-->
{{ with ($styles.vendor.external) }}
@ -9,6 +10,15 @@
{{ end }}
<!--[ / vendor-external ]-->
<!--[ highlight-external ]-->
{{ with ($hljs.external) }}
{{ range . }}
<link rel="preload" href="{{ . }}" as="style" crossorigin="anonymous"/>
<link rel="stylesheet" href="{{ . }}" crossorigin="anonymous"/>
{{ end }}
{{ end }}
<!--[ / highlight-external ]-->
<!--[ vendor-internal ]-->
{{ with ($styles.vendor.internal) }}
{{ $bundle := slice }}
@ -20,6 +30,17 @@
{{ end }}
<!--[ / vendor-internal ]-->
<!--[ highlight-internal ]-->
{{ with ($hljs.internal) }}
{{ $bundle := slice }}
{{ range . }}{{ $bundle = (($bundle) | append (resources.Get .)) }}{{ end }}
{{ $bundle = (($bundle) | resources.Concat "css/hljs.bundle.scss") }}
{{ $bundle = ((($bundle) | resources.ToCSS) | minify) }}
<link rel="preload" href="{{ ($bundle.RelPermalink) }}" as="style"/>
<link rel="stylesheet" href="{{ ($bundle.RelPermalink) }}"/>
{{ end }}
<!--[ / highlight-internal ]-->
<!--[ system-internal ]-->
{{ with ($styles.system.internal) }}
{{ $bundle := slice }}

View file

@ -1,4 +1,5 @@
{{ $scripts := (($.Site.Data.ui.scripts) | default slice) }}
{{ $scripts := ($.Site.Data.ui.scripts) }}
{{ $hljs := ($.Site.Params.highlight.scripts) }}
<!--[ vendor-external ]-->
{{ with ($scripts.vendor.external) }}
@ -8,6 +9,14 @@
{{ end }}
<!--[ / vendor-external ]-->
<!--[ highlight-external ]-->
{{ with ($hljs.external) }}
{{ range . }}
<script src="{{ . }}" crossorigin="anonymous" defer></script>
{{ end }}
{{ end }}
<!--[ / highlight-external ]-->
<!--[ vendor-internal ]-->
{{ with ($scripts.vendor.internal) }}
{{ $bundle := slice }}
@ -18,6 +27,14 @@
{{ end }}
<!--[ / vendor-internal ]-->
<!--[ highlight-external ]-->
{{ with ($hljs.internal) }}
{{ range . }}
<script src="{{ . }}" crossorigin="anonymous" defer></script>
{{ end }}
{{ end }}
<!--[ / highlight-external ]-->
<!--[ system-internal ]-->
{{ with ($scripts.system.internal) }}
{{ $bundle := slice }}