Bundle icons into a single file.

This commit is contained in:
2026-01-30 19:12:27 +00:00
parent 4f39875786
commit be69164c8f
6 changed files with 22 additions and 10 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ async def wwwroot(req, path=""):
@app.route("/favicon.ico", methods=["GET", "HEAD"]) @app.route("/favicon.ico", methods=["GET", "HEAD"])
async def favicon(req): async def favicon(req):
# Browsers keep asking for it when viewing files (not HTML with icon link) # Browsers keep asking for it when viewing files (not HTML with icon link)
return redirect("/assets/logo-97d1d7eb.svg", status=308) return redirect("/assets/logo-ctv8tVwU.svg", status=308)
def get_files(wanted: set) -> list[tuple[PurePosixPath, Path]]: def get_files(wanted: set) -> list[tuple[PurePosixPath, Path]]:
+2 -1
View File
@@ -31,11 +31,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import home from '@/assets/svg/home.svg' import { Home } from '@/assets/svg'
import { nextTick, onBeforeUpdate, ref, watchEffect } from 'vue' import { nextTick, onBeforeUpdate, ref, watchEffect } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { exists } from '@/utils/fileutil' import { exists } from '@/utils/fileutil'
const home = Home
const router = useRouter() const router = useRouter()
const links = [] as Array<HTMLElement> const links = [] as Array<HTMLElement>
+2 -1
View File
@@ -11,9 +11,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { useMainStore } from '@/stores/main' import { useMainStore } from '@/stores/main'
import cog from '@/assets/svg/cog.svg' import { Cog } from '@/assets/svg'
import { exists } from '@/utils/fileutil' import { exists } from '@/utils/fileutil'
const cog = Cog
const store = useMainStore() const store = useMainStore()
const props = defineProps<{ const props = defineProps<{
path: string[], path: string[],
+1 -1
View File
@@ -16,7 +16,7 @@
<script setup lang=ts> <script setup lang=ts>
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import type { Doc } from '@/repositories/Document' import type { Doc } from '@/repositories/Document'
import PlayIcon from '@/assets/svg/play.svg' import { Play as PlayIcon } from '@/assets/svg'
const aud = ref<HTMLAudioElement | null>(null) const aud = ref<HTMLAudioElement | null>(null)
const vid = ref<HTMLVideoElement | null>(null) const vid = ref<HTMLVideoElement | null>(null)
+4 -6
View File
@@ -1,18 +1,16 @@
<template> <template>
<button class="action-button"> <button class="action-button">
<component :is="icon" /> <component :is="icons[name]" />
<slot></slot> <slot></slot>
</button> </button>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineAsyncComponent } from 'vue' import { icons, type IconName } from '@/assets/svg'
const props = defineProps<{ defineProps<{
name: string name: IconName
}>() }>()
const icon = defineAsyncComponent(() => import(`@/assets/svg/${props.name}.svg`))
</script> </script>
<style> <style>
+12
View File
@@ -30,4 +30,16 @@ export default defineConfig({
'@': fileURLToPath(new URL('./src', import.meta.url)) '@': fileURLToPath(new URL('./src', import.meta.url))
} }
}, },
build: {
rollupOptions: {
output: {
manualChunks: {
// Bundle all SVG icons into a single chunk
icons: [
'/src/assets/svg/index.ts',
],
},
},
},
},
}) })