From 0dca32ea7a3f7f64c540b5e42e0f5554be6c267b Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 9 Nov 2023 12:23:52 +0100 Subject: [PATCH] Fix css loading order in head --- web/index.html | 1 - web/vite.config.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/web/index.html b/web/index.html index b0edf180c6..94e0c07b83 100644 --- a/web/index.html +++ b/web/index.html @@ -8,7 +8,6 @@ Woodpecker -
diff --git a/web/vite.config.ts b/web/vite.config.ts index ff89989c84..69186c25d6 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -25,6 +25,24 @@ function woodpeckerInfoPlugin() { }; } +function externalCSSPlugin() { + return { + name: 'external-css', + transformIndexHtml: { + enforce: 'post', + transform() { + return [ + { + tag: 'link', + attrs: { rel: 'stylesheet', type: 'text/css', href: '/assets/custom.css' }, + injectTo: 'head', + }, + ]; + }, + }, + }; +} + // https://vitejs.dev/config/ export default defineConfig({ plugins: [ @@ -93,6 +111,7 @@ export default defineConfig({ Components({ resolvers: [IconsResolver()], }), + externalCSSPlugin(), woodpeckerInfoPlugin(), prismjs({ languages: ['yaml'],