From b7e304a70892555052b58a1b4c46947b789f1de4 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Thu, 7 Dec 2023 14:34:21 -0800 Subject: [PATCH] Fix broken CSS due to bug in Cloudflare minifier --- frontend/vite.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 1aaa3232..52957796 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -71,6 +71,11 @@ export default defineConfig({ }, }), ], + output: { + // Inject `.min` into the filename of minified CSS files to tell Cloudflare not to minify it again. + // Cloudflare's minifier breaks the CSS due to a bug where it removes whitespace around calc() plus operators. + assetFileNames: (info) => `assets/[name]-[hash]${info.name?.endsWith(".css") ? ".min" : ""}[extname]`, + }, }, }, });