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 <script
src="{{ static.scripts.bootstrap.src | default('') }}" src="{{ script.src }}"
integrity="{{ static.scripts.bootstrap.integrity | default('') }}" {{- 'integrity="' + script.integrity + '"' if script.integrity else omit }}
crossorigin="{{ static.scripts.bootstrap.crossorigin | default('anonymous' if static.scripts.bootstrap.integrity else '') }}" {{- 'crossorigin="' + script.crossorigin + '"' if script.integrity else omit }}
></script> ></script>
{% endif %}
{% endfor %}
{% endif %} {% endif %}
</body> </body>
</html> </html>

View File

@ -16,7 +16,7 @@
<img <img
class="card-image-top" class="card-image-top"
width="{{ this.width | default('100%') }}" width="{{ this.width | default('100%') }}"
height="{{ this.height | default('225') }}" height="{{ this.height | default('100%') }}"
src="{{ this.src }}" src="{{ this.src }}"
alt="{{ this.alt_text if this.alt_text else this.title }}" 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') }}" data-bs-theme="{{ css_theme_name | default('auto') }}"
> >
<head> <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 <script
src="{{ static.scripts.theme.src | default('') }}" src="{{ script.src }}"
integrity="{{ static.scripts.theme.integrity | default('') }}" {{- 'integrity="' + script.integrity + '"' if script.integrity else omit }}
crossorigin="{{ static.scripts.theme.crossorigin | default('anonymous' if static.scripts.theme.integrity else '') }}" {{- 'crossorigin="' + script.crossorigin + '"' if script.integrity else omit }}
></script> ></script>
{% endif %}
{% endfor %}
{% endif %} {% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1" /> <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"> <link rel="icon" href="/docs/5.3/assets/img/favicons/favicon.ico">
--> -->
{% if static.css.bootstrap %} {% if static.css | length >= 1 +%}
<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.theme %} <!-- CSS -->
<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 %}
{% if static.css.icons %} {% for _, style in static.css | items %}
<link <link
rel="stylesheet" rel="stylesheet"
href="{{ static.css.icons.src }}" href="{{ style.src }}"
integrity="{{ static.css.icons.integrity | default('') }}" {{- 'integrity="' + style.integrity + '"' if style.integrity else omit }}
crossorigin="{{ static.css.icons.crossorigin | default('anonymous' if static.css.icons.integrity else '') }}" {{- 'crossorigin="' + style.crossorigin + '"' if style.integrity else omit }}
/> />
{% endif %}
{% endfor %}
{% endif %}
</head> </head>

View File

@ -21,7 +21,7 @@ template_vars = {
"bootstrap": { "bootstrap": {
"src": "./templates/static/bootstrap.bundle.min.js", "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": { "css": {
"bootstrap": {"src": "./templates/static/bootstrap.min.css"}, "bootstrap": {"src": "./templates/static/bootstrap.min.css"},