Build-time minification, image optimization, htmx SPA navigation, and local htmx bundle
This commit is contained in:
parent
50a5ca2c71
commit
b95d5c2ee5
13 changed files with 186 additions and 115 deletions
|
|
@ -24,6 +24,13 @@ func processImage(fileName string) string {
|
|||
return dst[4:]
|
||||
}
|
||||
|
||||
templ AvifImage(srcPath, alt string) {
|
||||
<img src={ processImage(srcPath) } alt={ alt }/>
|
||||
templ AvifImage(srcPath, alt string, lazy bool, priority bool) {
|
||||
<img src={ processImage(srcPath) } alt={ alt }
|
||||
if lazy {
|
||||
loading="lazy"
|
||||
}
|
||||
if priority {
|
||||
fetchpriority="high"
|
||||
}
|
||||
/>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@ templ Index() {
|
|||
<a href="wyroby.html" class="btn">Zobacz naszą ofertę</a>
|
||||
</div>
|
||||
<div>
|
||||
@AvifImage("001.avif", "tort")
|
||||
@AvifImage("001.avif", "tort", false, true)
|
||||
</div>
|
||||
</header>
|
||||
<section id="about-us">
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
@AvifImage("002.avif", "kawiarnia")
|
||||
@AvifImage("002.avif", "kawiarnia", true, false)
|
||||
</div>
|
||||
<div>
|
||||
@AvifImage("003.avif", "kawiarnia")
|
||||
@AvifImage("003.avif", "kawiarnia", true, false)
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -42,7 +42,7 @@ templ Index() {
|
|||
<h2>Nasze Wyroby</h2>
|
||||
<div class="card">
|
||||
<div>
|
||||
@AvifImage("004.avif", "tort")
|
||||
@AvifImage("004.avif", "tort", true, false)
|
||||
</div>
|
||||
<div>
|
||||
<h3>Torty Okazjonalne</h3>
|
||||
|
|
@ -69,7 +69,7 @@ templ Index() {
|
|||
</div>
|
||||
<div class="card">
|
||||
<div>
|
||||
@AvifImage("005.avif", "ciasto")
|
||||
@AvifImage("005.avif", "ciasto", true, false)
|
||||
</div>
|
||||
<div class="greener">
|
||||
<h3>Domowe Ciasta</h3>
|
||||
|
|
@ -96,7 +96,7 @@ templ Index() {
|
|||
</div>
|
||||
<div class="card">
|
||||
<div>
|
||||
@AvifImage("006.avif", "slodkosci")
|
||||
@AvifImage("006.avif", "slodkosci", true, false)
|
||||
</div>
|
||||
<div>
|
||||
<h3>Słodkie Stoły</h3>
|
||||
|
|
@ -174,10 +174,10 @@ templ Index() {
|
|||
</div>
|
||||
<div>
|
||||
<div>
|
||||
@AvifImage("007.avif", "kawiarnia")
|
||||
@AvifImage("007.avif", "kawiarnia", true, false)
|
||||
</div>
|
||||
<div>
|
||||
@AvifImage("008.avif", "ciasto i kawa")
|
||||
@AvifImage("008.avif", "ciasto i kawa", true, false)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ templ Kawiarnia() {
|
|||
</p>
|
||||
</div>
|
||||
<div>
|
||||
@AvifImage("009.avif", "kawiarnia")
|
||||
@AvifImage("009.avif", "kawiarnia", false, true)
|
||||
<div></div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@ templ layout(activePage string) {
|
|||
<meta name="description" content=""/>
|
||||
<link href="style.css" rel="stylesheet"/>
|
||||
<link rel="icon" href="images/favicon.avif"/>
|
||||
<script src="htmx.min.js"></script>
|
||||
<script defer src="portfolio.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body hx-boost="true">
|
||||
<nav>
|
||||
<div>
|
||||
<a href="index.html">
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ templ Portfolio(images []string, activePage string, pages []string) {
|
|||
<div id="portfolio-grid">
|
||||
for _, img := range images {
|
||||
<div>
|
||||
@AvifImage("portfolio/"+img, "portfolio")
|
||||
@AvifImage("portfolio/"+img, "portfolio", true, false)
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import "piekarnikgosi/types"
|
|||
templ card(product types.Product) {
|
||||
<div class="card">
|
||||
<div>
|
||||
@AvifImage("wyroby/"+product.Image+".avif", product.Name)
|
||||
@AvifImage("wyroby/"+product.Image+".avif", product.Name, true, false)
|
||||
</div>
|
||||
<div>
|
||||
<h3>{ product.Name }</h3>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ templ WyrobyTorty() {
|
|||
<header>
|
||||
<h2>Torty Musowe</h2>
|
||||
<div>
|
||||
@AvifImage("010.avif", "tort musowy")
|
||||
@AvifImage("010.avif", "tort musowy", true, false)
|
||||
</div>
|
||||
</header>
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue