Moving css/js for code blocks into the bundle instead of pulling it from a cdn

This commit is contained in:
Johannes Bülow 2025-06-17 17:03:20 +02:00
parent a381ef8cf6
commit bfae1c1aa7
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
4 changed files with 1218 additions and 4 deletions

1213
server/web/assets/highlight.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
server/web/assets/pojoaque.min.css vendored Normal file
View file

@ -0,0 +1 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#dccf8f;background:url(./pojoaque.jpg) left top #181914}.hljs-comment,.hljs-quote{color:#586e75;font-style:italic}.hljs-addition,.hljs-keyword,.hljs-literal,.hljs-selector-tag{color:#b64926}.hljs-doctag,.hljs-number,.hljs-regexp,.hljs-string{color:#468966}.hljs-built_in,.hljs-name,.hljs-section,.hljs-title{color:#ffb03b}.hljs-class .hljs-title,.hljs-tag,.hljs-template-variable,.hljs-title.class_,.hljs-type,.hljs-variable{color:#b58900}.hljs-attribute{color:#b89859}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-subst,.hljs-symbol{color:#cb4b16}.hljs-deletion{color:#dc322f}.hljs-selector-class,.hljs-selector-id{color:#d3a60c}.hljs-formula{background:#073642}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}

View file

@ -78,8 +78,8 @@ var handle = templ.NewOnceHandle()
templ Script() {
@handle.Once() {
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/pojoaque.min.css"/>
<script nonce={ templ.GetNonce(ctx) } src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<link rel="stylesheet" href="/assets/pojoaque.min.css"/>
<script nonce={ templ.GetNonce(ctx) } src="/assets/highlight.min.js"></script>
<script nonce={ templ.GetNonce(ctx) }>
(function() { // IIFE Start
function whenHljsReady(callback, attempt = 1) {

View file

@ -213,7 +213,7 @@ func Script() templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/pojoaque.min.css\"><script nonce=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<link rel=\"stylesheet\" href=\"/assets/pojoaque.min.css\"><script nonce=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@ -226,7 +226,7 @@ func Script() templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\" src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js\"></script> <script nonce=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\" src=\"/assets/highlight.min.js\"></script> <script nonce=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}