Proper pre-loading and deps

This commit is contained in:
2024-10-30 23:50:34 -06:00
parent 24bf04aa7a
commit 561905aabb
13 changed files with 880 additions and 825 deletions

View File

@ -47,6 +47,4 @@ Atridad Lahiji // Root
{{end}}
{{define "foot"}}
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.sse.js"></script>
{{end}}
{{end}}

View File

@ -10,12 +10,14 @@
{{template "head" .}}
</head>
<body class="block h-[100%]">
<body class="block h-[100%]" hx-ext="preload">
{{template "header" .}}
<main class="container flex flex-col items-center justify-center gap-3 sm:gap-6 p-4 text-center mx-auto min-h-[calc(100%-64px)]">
{{template "main" .}}
</main>
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.preload.js"></script>
{{template "foot" .}}
</body>
</html>

View File

@ -42,7 +42,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
</button>
<a href="/posts" class="btn btn-primary btn-outline">
<a href="/posts" class="btn btn-primary btn-outline" preload="mouseover">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-2"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11"/></svg>
Back
</a>
@ -52,6 +52,8 @@
</article>
</main>
<script src="/public/js/htmx.preload.js"></script>
<script src="/public/js/htmx.base.js"></script>
{{template "foot" .}}
</body>
</html>

View File

@ -1,7 +1,7 @@
{{define "buttonlinks"}}
{{if eq true .Internal}}
<a class="btn btn-primary btn-outline btn-md lg:btn-lg" href={{.Href}}>
<a class="btn btn-primary btn-outline btn-md lg:btn-lg" href={{.Href}} preload="mouseover">
{{.Name}}
</a>
@ -12,4 +12,4 @@
</a>
{{end}}
{{end}}
{{end}}

View File

@ -32,6 +32,7 @@
href={{.Href}}
aria-label={{.Name}}
class="btn btn-circle btn-base-100 text-primary hover:btn-accent hover:text-neutral"
preload="mouseover"
>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>
</a>

View File

@ -11,6 +11,7 @@
<ul
tabindex="0"
class="menu menu-compact dropdown-content gap-2 mt-3 p-2 shadow bg-base-100 rounded-box"
preload="mouseover"
>
{{template "navitems" .}}
</ul>

View File

@ -15,6 +15,5 @@ Atridad Lahiji // Post
{{end}}
{{define "foot"}}
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/hyperscript.js"></script>
{{end}}

View File

@ -31,6 +31,5 @@ Atridad Lahiji // Tools // SSE Demo
{{end}}
{{define "foot"}}
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.sse.js"></script>
{{end}}
{{end}}