| 1 |
--- |
| 2 |
import fs from 'node:fs'; |
| 3 |
import path from 'node:path'; |
| 4 |
|
| 5 |
// Auto-calculate bundle size from actual dist file |
| 6 |
const distPath = path.resolve(import.meta.dirname, '../../../dist/htmx.min.js.br'); |
| 7 |
const stats = fs.statSync(distPath); |
| 8 |
const bundleSize = `~${Math.floor(stats.size / 1024)}k`; |
| 9 |
|
| 10 |
// Auto-calculate extension count |
| 11 |
const extensionDocs = import.meta.glob('../content/extensions/*.md', { eager: true }) as Record<string, any>; |
| 12 |
const extensionCount = Object.keys(extensionDocs).filter(file => { |
| 13 |
const slug = file.split('/').pop() || ''; |
| 14 |
return !slug.includes('overview') && !slug.startsWith('01-'); |
| 15 |
}).length; |
| 16 |
--- |
| 17 |
|
| 18 |
<p class="hero-stats"> |
| 19 |
<a href="/docs#installation"> |
| 20 |
<b>{bundleSize}</b> min.br'd</a> |
| 21 |
<span aria-hidden="true">·</span> |
| 22 |
<a href="https://github.com/bigskysoftware/htmx/blob/master/package.json" target="_blank" rel="noopener noreferrer"> |
| 23 |
<b>0</b> dep<span class="full-word">endencie</span>s</a> |
| 24 |
<span aria-hidden="true">·</span> |
| 25 |
<a href="/docs/extensions"> |
| 26 |
<b>{extensionCount}</b> extension<span class="full-word">s</span></a> |
| 27 |
</p> |
| 28 |
|
| 29 |
<style> |
| 30 |
.hero-stats { |
| 31 |
display: flex; |
| 32 |
align-items: center; |
| 33 |
gap: 0.75rem; |
| 34 |
font-size: 0.75rem; |
| 35 |
font-family: var(--font-mono); |
| 36 |
font-weight: 300; |
| 37 |
color: light-dark(var(--color-neutral-650), var(--color-neutral-350)); |
| 38 |
|
| 39 |
@media (min-width: 640px) { gap: 1rem; } |
| 40 |
|
| 41 |
a { |
| 42 |
text-decoration: none; |
| 43 |
|
| 44 |
b { font-family: var(--font-chicago); } |
| 45 |
|
| 46 |
@media (hover: hover) { |
| 47 |
&:hover, &:hover b { |
| 48 |
color: light-dark(var(--color-blue-600), var(--color-blue-300)); |
| 49 |
text-decoration: underline; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
&:is(:focus-visible, :active), |
| 54 |
&:is(:focus-visible, :active) b { |
| 55 |
color: light-dark(var(--color-blue-600), var(--color-blue-300)); |
| 56 |
text-decoration: underline; |
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
[aria-hidden] { color: light-dark(var(--color-neutral-300), var(--color-neutral-700)); } |
| 62 |
|
| 63 |
.full-word { |
| 64 |
display: none; |
| 65 |
@media (min-width: 640px) { display: inline; } |
| 66 |
} |
| 67 |
</style> |