mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
assetbuster: use asset buster for all resources #875
This commit is contained in:
parent
c90d41e5c1
commit
1b2e139512
22 changed files with 180 additions and 153 deletions
|
@ -1,2 +1,3 @@
|
|||
@import "{{ printf "%s-%s.css" .prefix .light }}" screen and (prefers-color-scheme: light);
|
||||
@import "{{ printf "%s-%s.css" .prefix .dark }}" screen and (prefers-color-scheme: dark);
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
|
||||
@import "{{ printf "%s-%s.css%s" .prefix .light $assetBusting }}" screen and (prefers-color-scheme: light);
|
||||
@import "{{ printf "%s-%s.css%s" .prefix .dark $assetBusting }}" screen and (prefers-color-scheme: dark);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@import "{{ printf "theme-%s.css" .themevariant.identifier }}";
|
||||
@import "{{ printf "chroma-%s.css" .themevariant.chroma }}";
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
|
||||
@import "{{ printf "theme-%s.css%s" .themevariant.identifier $assetBusting }}";
|
||||
@import "{{ printf "chroma-%s.css%s" .themevariant.chroma $assetBusting }}";
|
||||
|
||||
#R-sidebar {
|
||||
display: none;
|
||||
|
|
2
assets/css/print.css
Normal file
2
assets/css/print.css
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
|
||||
@import "{{ printf "format-print.css%s" $assetBusting }}";
|
|
@ -1,7 +1,8 @@
|
|||
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
|
||||
/* Styles to make Swagger-UI fit into our theme */
|
||||
|
||||
@import "fonts.css";
|
||||
@import "variant-internal.css";
|
||||
@import "{{ printf "fonts.css%s" $assetBusting }}";
|
||||
@import "{{ printf "variables.css%s" $assetBusting }}";
|
||||
|
||||
body{
|
||||
line-height: 1.574;
|
|
@ -1,3 +1,4 @@
|
|||
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
|
||||
/* this file is here for compatiblity with older installations
|
||||
use theme-relearn-light instead */
|
||||
@import "theme-relearn-light.css";
|
||||
@import "{{ printf "theme-relearn-light.css%s" $assetBusting }}";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@import "variant-internal.css";
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . -}}
|
||||
@import "{{ printf "variables.css%s" $assetBusting }}";
|
||||
|
||||
html {
|
||||
color-scheme: only var(--INTERNAL-BROWSER-theme);
|
|
@ -22,6 +22,8 @@ This document shows you what's new in the latest release and flags it with one o
|
|||
|
||||
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`include` shortcode](shortcodes/include) is now able to resolve links to pages as well as resources or files in the file system (the old behavior).
|
||||
|
||||
- {{% badge style="note" title=" " %}}Change{{% /badge %}} To make the asset buster mechanism more robust, some internally used stylesheets where restructured. This generally should not affect your page in any negative way.
|
||||
|
||||
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The [`openapi` shortcode](shortcodes/openapi) is now able to resolve links to resources as well as to files in the file system (the old behavior). You can configure to generate warnings or errors during build by setting `openapi.errorlevel` to either `warning` or `error` in your `hugo.toml` if a path can not be resolved.
|
||||
|
||||
---
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
<span class="github-buttons"></span>
|
||||
<p>Built with <a href="https://github.com/McShelby/hugo-theme-relearn" title="love"><i class="fas fa-heart"></i></a> by <a href="https://gohugo.io/">Hugo</a></p>
|
||||
<script>
|
||||
|
@ -7,14 +7,14 @@
|
|||
var colorPropertyValue = window.getComputedStyle( document.querySelector( '#R-sidebar' ) ).getPropertyValue( 'background-color' );
|
||||
var colorValues = colorPropertyValue.match( /\d+/g ).map( function( e ){ return parseInt(e,10); });
|
||||
if( colorValues.length === 3 && ((0.2126 * colorValues[0]) + (0.7152 * colorValues[1]) + (0.0722 * colorValues[2]) < 165) ){
|
||||
// Luma, https://en.wikipedia.org/wiki/Luma_%28video%29, SMPTE C, Rec. 709 weightings
|
||||
{{- /* Luma, https://en.wikipedia.org/wiki/Luma_%28video%29, SMPTE C, Rec. 709 weightings */}}
|
||||
scheme = 'dark';
|
||||
}
|
||||
return scheme;
|
||||
}
|
||||
function githubButtonsInit(){
|
||||
if( !window.githubButtons ){
|
||||
// wait for the script to load
|
||||
{{- /* wait for the script to load */}}
|
||||
setTimeout( githubButtonsInit, 50 );
|
||||
return;
|
||||
}
|
||||
|
@ -33,11 +33,11 @@
|
|||
});
|
||||
}
|
||||
document.addEventListener( 'themeVariantLoaded', function( e ){
|
||||
// we have to wait until the CSS class .default-animation has settled and the buttons have loaded to recalculate the scheme again
|
||||
{{- /* we have to wait until the CSS class .default-animation has settled and the buttons have loaded to recalculate the scheme again */}}
|
||||
setTimeout( githubButtonsInit, 400 );
|
||||
});
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
||||
setTimeout( githubButtonsInit, 400 );
|
||||
});
|
||||
</script>
|
||||
<script async src="{{"js/github-buttons.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script async src="{{"js/github-buttons.js" | relURL}}{{ $assetBusting }}"></script>
|
6
layouts/partials/assetbusting.hugo
Normal file
6
layouts/partials/assetbusting.hugo
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{- $assetsBuster := "" }}
|
||||
{{- $assetBusting := not site.Params.disableAssetsBusting }}
|
||||
{{- if $assetBusting }}
|
||||
{{- $assetsBuster = printf "?%d" now.Unix }}
|
||||
{{- end }}
|
||||
{{- return $assetsBuster }}
|
|
@ -2,6 +2,7 @@
|
|||
{{- $location := .location }}
|
||||
{{- if eq $location "footer" }}
|
||||
{{- with $page }}
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
{{- $init := "{}" }}
|
||||
{{- if isset .Params "mathjaxinitialize" }}
|
||||
{{- $init = .Params.mathJaxInitialize }}
|
||||
|
@ -27,7 +28,7 @@
|
|||
{{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }}
|
||||
<script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script>
|
||||
{{- else }}
|
||||
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ $assetBusting }}"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -2,22 +2,23 @@
|
|||
{{- $location := .location }}
|
||||
{{- if eq $location "footer" }}
|
||||
{{- with $page }}
|
||||
<script src="{{"js/d3/d3-color.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-dispatch.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-drag.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-ease.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-interpolate.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-selection.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-timer.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-transition.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/d3/d3-zoom.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/js-yaml.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
<script src="{{"js/d3/d3-color.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-dispatch.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-drag.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-ease.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-interpolate.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-selection.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-timer.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-transition.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/d3/d3-zoom.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- if and (isset .Params "custommermaidurl") .Params.customMermaidURL }}
|
||||
<script src="{{ .Params.customMermaidURL }}" defer></script>
|
||||
{{- else if and (isset .Site.Params "custommermaidurl") .Site.Params.customMermaidURL }}
|
||||
<script src="{{ .Site.Params.customMermaidURL }}" defer></script>
|
||||
{{- else }}
|
||||
<script src="{{"js/mermaid.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/mermaid.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
{{- $init := "{}" }}
|
||||
{{- if isset .Params "mermaidinitialize" }}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
{{- $location := .location }}
|
||||
{{- if eq $location "footer" }}
|
||||
{{- with $page }}
|
||||
<script src="{{"js/js-yaml.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
<script src="{{"js/js-yaml.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- $urlOpenapi := "" }}
|
||||
{{- $relOpenapi := "" }}
|
||||
{{- $cssInProject := false }}
|
||||
|
@ -13,8 +14,8 @@
|
|||
{{- $urlOpenapi = .Site.Params.customOpenapiURL }}
|
||||
{{- $relOpenapi = .Site.Params.customOpenapiURL }}
|
||||
{{- else }}
|
||||
{{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) (cond .Site.Params.disableAssetsBusting "" (printf "?%d" now.Unix)) }}
|
||||
{{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") (cond .Site.Params.disableAssetsBusting "" (printf "?%d" now.Unix)) }}
|
||||
{{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) $assetBusting }}
|
||||
{{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") $assetBusting }}
|
||||
{{- $cssInProject = true }}
|
||||
{{- end }}
|
||||
<script>window.noZensmooth = true;</script>
|
||||
|
@ -24,7 +25,7 @@
|
|||
{{- $relOpenapi := replace $relOpenapi "swagger-ui-bundle" "swagger-ui" }}
|
||||
{{- $relOpenapi := replace $relOpenapi ".js" ".css" }}
|
||||
<script>
|
||||
window.themeUseOpenapi = { css: {{ $relOpenapi }}, cssInProject: {{ $cssInProject | safeJS }}, assetsBuster: {{ cond (not .Site.Params.disableAssetsBusting) now.Unix 0 }} };
|
||||
window.themeUseOpenapi = { css: {{ $relOpenapi }}, cssInProject: {{ $cssInProject | safeJS }}, assetsBuster: "{{ $assetBusting }}" };
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,4 +1,4 @@
|
|||
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
{{- $faviconMatch := false }}
|
||||
{{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }}
|
||||
{{- $png := dict "ext" "png" "type" "type=\"image/png\"" }}
|
||||
|
@ -10,15 +10,15 @@
|
|||
{{- range $faviconTypes }}
|
||||
{{- if fileExists (printf "/static/images/%s.%s" $faviconName .ext) }}
|
||||
{{- $faviconMatch = true }}
|
||||
<link href="{{ printf "images/%s.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }}>
|
||||
<link href="{{ printf "images/%s.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- if (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) }}
|
||||
{{- $faviconMatch = true }}
|
||||
<link href="{{ printf "images/%s-light.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: light)">
|
||||
<link href="{{ printf "images/%s-light.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: light)">
|
||||
{{- end }}
|
||||
{{- if (fileExists (printf "/static/images/%s-dark.%s" $faviconName .ext)) }}
|
||||
{{- $faviconMatch = true }}
|
||||
<link href="{{ printf "images/%s-dark.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: dark)">
|
||||
<link href="{{ printf "images/%s-dark.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: dark)">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $faviconMatch }}
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
</div><!-- #R-body -->
|
||||
{{- $outputFormat := partial "output-format.hugo" .Page }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "menu" "page" . "parameter" . "outputFormat" $outputFormat) }}
|
||||
<script src="{{"js/clipboard.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- partial "dependencies.html" (dict "page" . "location" "footer" "outputFormat" $outputFormat) }}
|
||||
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- partial "custom-footer.html" . }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{{- $page := . }}
|
||||
{{- $autores := resources.Get "css/auto.css" }}
|
||||
{{- $printres := resources.Get "css/format-print.css" }}
|
||||
{{- $nonautothemevariants := slice }}
|
||||
{{- /* we need relearn-light in every case for the print styles */}}
|
||||
{{- $refthemevariants := slice | append "relearn-light" }}
|
||||
|
@ -108,7 +107,20 @@ Chroma auto run:
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $cssres := $printres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0)) }}
|
||||
{{- $swaggerres := resources.Get "css/swagger.css" }}
|
||||
{{- $cssres := $swaggerres | resources.ExecuteAsTemplate "css/swagger.css" (dict) }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
|
||||
{{- $variantres := resources.Get "css/variant.css" }}
|
||||
{{- $cssres := $variantres | resources.ExecuteAsTemplate "css/variant.css" (dict) }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
|
||||
{{- $printres := resources.Get "css/print.css" }}
|
||||
{{- $cssres := $printres | resources.ExecuteAsTemplate "css/print.css" (dict) }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
|
||||
{{- $formatprintres := resources.Get "css/format-print.css" }}
|
||||
{{- $cssres := $formatprintres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0)) }}
|
||||
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}<!-- {{ $cssres.RelPermalink }} -->
|
||||
|
||||
{{- return collections.Where $themevariants "config" true }}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<button class="search-clear" type="button" data-search-clear="" title="{{ T "Clear-search" }}"><i class="fas fa-times" title="{{ T "Clear-search" }}"></i></button>
|
||||
</div>
|
||||
{{ if $link }}</form>{{ end }}</search>
|
||||
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }}
|
||||
{{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
|
||||
{{- $quotedcontentlangs := slice }}
|
||||
|
@ -32,22 +32,22 @@
|
|||
<script>
|
||||
var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
|
||||
</script>
|
||||
<script src="{{"js/auto-complete.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/auto-complete.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- $tinyseg := false }}
|
||||
{{- $wordcut := false }}
|
||||
{{- range $contentlangs }}
|
||||
{{- if and (not $tinyseg) (or (eq . "ja")) }}
|
||||
{{- $tinyseg = true }}
|
||||
<script src="{{"js/lunr/tinyseg.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/lunr/tinyseg.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
{{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }}
|
||||
{{- $wordcut = true }}
|
||||
<script src="{{"js/lunr/wordcut.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{"js/lunr/wordcut.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
{{- $file := (printf "js/lunr/lunr.%s.min.js" .) }}
|
||||
<script src="{{ $file | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{ $file | relURL}}{{ $assetBusting }}" defer></script>
|
||||
{{- end }}
|
||||
<script src="{{ "js/search.js" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||
<script src="{{ "js/search.js" | relURL }}{{ $assetBusting }}" defer></script>
|
|
@ -5,33 +5,33 @@
|
|||
{{- $outputFormat = partial "output-format.hugo" $page }}
|
||||
{{- end }}
|
||||
{{- with $page }}
|
||||
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
{{- /* https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use */}}
|
||||
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/nucleus.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||
<link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||
<link href="{{"css/fonts.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fonts.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/nucleus.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
<link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
<link href="{{"css/fonts.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fonts.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/theme.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
{{- $themevariants := partialCached "get-theme-variants.hugo" . }}
|
||||
{{- with index $themevariants 0 }}
|
||||
<link href="{{(printf "css/theme-%s.css" .identifier) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" id="R-variant-style">
|
||||
<link href="{{(printf "css/chroma-%s.css" .chroma) | safeHTML | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" id="R-variant-chroma-style">
|
||||
<link href="{{(printf "css/theme-%s.css" .identifier) | relURL}}{{ $assetBusting }}" rel="stylesheet" id="R-variant-style">
|
||||
<link href="{{(printf "css/chroma-%s.css" .chroma) | safeHTML | relURL}}{{ $assetBusting }}" rel="stylesheet" id="R-variant-chroma-style">
|
||||
{{- end }}
|
||||
<link href="{{"css/variant.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||
<link href="{{"css/print.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print">
|
||||
<link href="{{"css/variant.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
<link href="{{"css/print.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print">
|
||||
{{- $f := printf "/static/css/format-%s.css" $outputFormat }}
|
||||
{{- if or (partialCached "fileExists.hugo" $f $f) (resources.Get (printf "/css/format-%s.css" $outputFormat)) }}
|
||||
<link href="{{(printf "css/format-%s.css" $outputFormat) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||
<link href="{{(printf "css/format-%s.css" $outputFormat) | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
{{- end }}
|
||||
<script src="{{"js/variant.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{"js/variant.js" | relURL}}{{ $assetBusting }}"></script>
|
||||
<script>
|
||||
window.relearn = window.relearn || {};
|
||||
window.relearn.relBasePath='{{ partial "relBasePath.hugo" $page | safeJS }}';
|
||||
window.relearn.relBaseUri='{{ partial "relBaseUri.hugo" $page | safeJS }}';
|
||||
window.relearn.absBaseUri='{{ replaceRE "/*$" "" .Site.BaseURL | safeJS }}';
|
||||
{{- with .Site.Home.OutputFormats.Get "search" }}
|
||||
window.index_js_url={{ "index.search.js" | relLangURL }};
|
||||
window.index_js_url={{ (printf "index.search.js%s" $assetBusting) | relLangURL }};
|
||||
{{- end }}
|
||||
{{ "// variant stuff" | safeJS }}
|
||||
{{- $quotedthemevariants := slice }}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
@import "format-print.css";
|
|
@ -1,50 +0,0 @@
|
|||
/* Tags */
|
||||
|
||||
.tags{
|
||||
margin-left: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.tags.term-list ul > li ~ li:before {
|
||||
content: " "
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link {
|
||||
border-bottom-right-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
box-shadow: 0 1px 2px rgba( 0, 0, 0, .2 );
|
||||
display: inline-block;
|
||||
font-size: 0.8em;
|
||||
font-weight: 400;
|
||||
line-height: 2em;
|
||||
margin: 0 0 8px -1px;
|
||||
margin-inline-end: 16px;
|
||||
padding: 0 10px 0 12px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link:before {
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 1em 1em 1em 0;
|
||||
content: "";
|
||||
left: -1em;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top:0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link:after {
|
||||
border-radius: 100%;
|
||||
content: "";
|
||||
left: 1px;
|
||||
height: 5px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link:hover:after {
|
||||
width: 5px;
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
@charset "UTF-8";
|
||||
|
||||
@import "tags.css";
|
||||
|
||||
/* until browsers don't let us set length values based on dppx, we
|
||||
need a way to calculate them ourself */
|
||||
:root {
|
||||
|
@ -326,6 +324,55 @@ dd {
|
|||
margin: 1.5rem 1rem 1rem 1rem;
|
||||
}
|
||||
|
||||
.tags{
|
||||
margin-left: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.tags.term-list ul > li ~ li:before {
|
||||
content: " "
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link {
|
||||
border-bottom-right-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
box-shadow: 0 1px 2px rgba( 0, 0, 0, .2 );
|
||||
display: inline-block;
|
||||
font-size: 0.8em;
|
||||
font-weight: 400;
|
||||
line-height: 2em;
|
||||
margin: 0 0 8px -1px;
|
||||
margin-inline-end: 16px;
|
||||
padding: 0 10px 0 12px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link:before {
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 1em 1em 1em 0;
|
||||
content: "";
|
||||
left: -1em;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top:0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link:after {
|
||||
border-radius: 100%;
|
||||
content: "";
|
||||
left: 1px;
|
||||
height: 5px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
#R-body .tags a.term-link:hover:after {
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
#R-body {
|
||||
display: flex;
|
||||
flex-basis: 100%;
|
||||
|
|
|
@ -378,9 +378,9 @@ function initOpenapi( update, attrs ){
|
|||
}
|
||||
function renderOpenAPI(oc) {
|
||||
var relBasePath = window.relearn.relBasePath;
|
||||
var buster = window.themeUseOpenapi.assetsBuster ? '?' + window.themeUseOpenapi.assetsBuster : '';
|
||||
var assetBuster = window.themeUseOpenapi.assetsBuster;
|
||||
var print = isPrint || attrs.isPrintPreview ? "PRINT-" : "";
|
||||
var theme = print ? `${relBasePath}/css/theme-relearn-light.css${buster}` : document.querySelector( '#R-variant-style' ).attributes.href.value
|
||||
var theme = print ? `${relBasePath}/css/theme-relearn-light.css${assetBuster}` : document.querySelector( '#R-variant-style' ).attributes.href.value
|
||||
var swagger_theme = variants.getColorValue( print + 'OPENAPI-theme' );
|
||||
var swagger_code_theme = variants.getColorValue( print + 'OPENAPI-CODE-theme' );
|
||||
|
||||
|
@ -404,8 +404,8 @@ function initOpenapi( update, attrs ){
|
|||
'<head>' +
|
||||
'<link rel="stylesheet" href="' + window.themeUseOpenapi.css + '">' +
|
||||
'<link rel="stylesheet" href="' + theme + '">' +
|
||||
'<link rel="stylesheet" href="' + relBasePath + '/css/swagger.css' + buster + '">' +
|
||||
'<link rel="stylesheet" href="' + relBasePath + '/css/swagger-' + swagger_theme + '.css' + buster + '">' +
|
||||
'<link rel="stylesheet" href="' + relBasePath + '/css/swagger.css' + assetBuster + '">' +
|
||||
'<link rel="stylesheet" href="' + relBasePath + '/css/swagger-' + swagger_theme + '.css' + assetBuster + '">' +
|
||||
'</head>' +
|
||||
'<body>' +
|
||||
'<a class="relearn-expander" href="" onclick="return relearn_collapse_all()">Collapse all</a>' +
|
||||
|
|
Loading…
Reference in a new issue