Only generate css classes for used repo colors

This in most cases will reduce the size of main.bundle.css dramatically. Before I had around ~+32kB, now it is ~+228B
This commit is contained in:
Served Smart
2025-06-22 22:20:49 +02:00
parent cc2e90233a
commit 65a50ff643
7 changed files with 36 additions and 39 deletions

View File

@@ -37,10 +37,8 @@
</p>
<div class="m-0 mt-2 flex items-center">
{{ $className := "color-repo-fallback" }}
{{ if .language }}
{{ $className = printf "color-repo-%s" (md5 .language) }}
{{ end }}
{{ $language := .language | default "fallback" }}
{{ $className := printf "background-color-%s" (md5 $language) }}
<span
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
@@ -73,5 +71,4 @@
data-repo-id="{{ $id }}"></script>
</a>
{{- end -}}
</div>