Compare commits

...

2 Commits

Author SHA1 Message Date
c0de 4b0af0ae99 rewrite script and css loading 2023-12-29 15:44:09 -06:00
c0de 664e4607ba Reset to 100% height (maybe we need max height) 2023-12-29 15:27:20 -06:00
4 changed files with 41 additions and 31 deletions

View File

@ -1,9 +1,19 @@
{% if static.scripts.bootstrap %}
{% if static.scripts | length >= 1 +%}
<!-- Scripts -->
{% for _, script in static.scripts | items %}
{# Load scripts at the bottom by default #}
{% if not script.place_in_head | default(False) %}
<script
src="{{ static.scripts.bootstrap.src | default('') }}"
integrity="{{ static.scripts.bootstrap.integrity | default('') }}"
crossorigin="{{ static.scripts.bootstrap.crossorigin | default('anonymous' if static.scripts.bootstrap.integrity else '') }}"
src="{{ script.src }}"
{{- 'integrity="' + script.integrity + '"' if script.integrity else omit }}
{{- 'crossorigin="' + script.crossorigin + '"' if script.integrity else omit }}
></script>
{% endif %}
{% endfor %}
{% endif %}
</body>
</html>

View File

@ -16,7 +16,7 @@
<img
class="card-image-top"
width="{{ this.width | default('100%') }}"
height="{{ this.height | default('225') }}"
height="{{ this.height | default('100%') }}"
src="{{ this.src }}"
alt="{{ this.alt_text if this.alt_text else this.title }}"
/>

View File

@ -48,12 +48,24 @@
data-bs-theme="{{ css_theme_name | default('auto') }}"
>
<head>
{% if static.scripts.theme %}
{# Scripts that should be loaded first to avoid flickering (theme, etc) #}
{% if static.scripts | length >= 1 %}
<!-- Scripts -->
{% for _, script in static.scripts | items %}
{# Only load script if it should be in the head #}
{% if script.place_in_head | default(False) %}
<script
src="{{ static.scripts.theme.src | default('') }}"
integrity="{{ static.scripts.theme.integrity | default('') }}"
crossorigin="{{ static.scripts.theme.crossorigin | default('anonymous' if static.scripts.theme.integrity else '') }}"
src="{{ script.src }}"
{{- 'integrity="' + script.integrity + '"' if script.integrity else omit }}
{{- 'crossorigin="' + script.crossorigin + '"' if script.integrity else omit }}
></script>
{% endif %}
{% endfor %}
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1" />
@ -92,31 +104,19 @@
<link rel="icon" href="/docs/5.3/assets/img/favicons/favicon.ico">
-->
{% if static.css.bootstrap %}
<link
rel="stylesheet"
href="{{ static.css.bootstrap.src }}"
integrity="{{ static.css.bootstrap.integrity | default('') }}"
crossorigin="{{ static.css.bootstrap.crossorigin | default('anonymous' if static.css.bootstrap.integrity else '') }}"
/>
{% endif %}
{% if static.css | length >= 1 +%}
{% if static.css.theme %}
<link
rel="stylesheet"
href="{{ static.css.theme.src }}"
integrity="{{ static.css.theme.integrity | default('') }}"
crossorigin="{{ static.css.theme.crossorigin | default('anonymous' if static.css.theme.integrity else '') }}"
/>
{% endif %}
<!-- CSS -->
{% if static.css.icons %}
{% for _, style in static.css | items %}
<link
rel="stylesheet"
href="{{ static.css.icons.src }}"
integrity="{{ static.css.icons.integrity | default('') }}"
crossorigin="{{ static.css.icons.crossorigin | default('anonymous' if static.css.icons.integrity else '') }}"
href="{{ style.src }}"
{{- 'integrity="' + style.integrity + '"' if style.integrity else omit }}
{{- 'crossorigin="' + style.crossorigin + '"' if style.integrity else omit }}
/>
{% endif %}
{% endfor %}
{% endif %}
</head>

View File

@ -21,7 +21,7 @@ template_vars = {
"bootstrap": {
"src": "./templates/static/bootstrap.bundle.min.js",
},
"theme": {"src": "./templates/static/color-modes.js"},
"theme": {"src": "./templates/static/color-modes.js", "place_in_head": True},
},
"css": {
"bootstrap": {"src": "./templates/static/bootstrap.min.css"},