From 194fbdf5204204bcca50eda6fced53ee4ae88793 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 13 Dec 2025 17:38:04 -0800 Subject: [PATCH] remove user.css on cloud to prevent failed requests on startup (#7442) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Removes the user.css put at top of the index.html when building for cloud. On local, now compiles to this (pictured): image Formatted, that looks like: ```html ComfyUI
``` On cloud, this: image ## Context On the cloud distribution, there are currently 401 errors appearing in the console from requests attempting to load custom user stylesheets: - `https://cloud.comfy.org/user.css` (returns 200) - `https://cloud.comfy.org/api/userdata/user.css` (returns 401) This is a feature inherited from local ComfyUI that allows users to add custom stylesheets. The implementation naively requests the stylesheet from the server, and if the user has added one, it gets loaded; otherwise, the request fails. This PR removes the custom stylesheet loading from the cloud distribution by removing it from teh index.html and only re-injecting it on non-cloud builds. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7442-remove-user-css-on-cloud-to-prevent-failed-requests-on-startup-2c86d73d3650813d82a0deb3b01cee74) by [Unito](https://www.unito.io) --- index.html | 2 -- vite.config.mts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8684af476..0ce0b7e99 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,6 @@ ComfyUI - - diff --git a/vite.config.mts b/vite.config.mts index 50dd7c0f6..c46b9191e 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -234,6 +234,39 @@ export default defineConfig({ tailwindcss(), typegpuPlugin({}), comfyAPIPlugin(IS_DEV), + // Inject legacy user stylesheet links for desktop/localhost only + { + name: 'inject-user-stylesheet-links', + enforce: 'post', + transformIndexHtml(html) { + if (DISTRIBUTION === 'cloud') return html + + return { + html, + tags: [ + { + tag: 'link', + attrs: { + rel: 'stylesheet', + type: 'text/css', + href: 'user.css' + }, + injectTo: 'head-prepend' + }, + { + tag: 'link', + attrs: { + rel: 'stylesheet', + type: 'text/css', + href: 'api/userdata/user.css' + }, + injectTo: 'head-prepend' + } + ] + } + } + }, + // Twitter/Open Graph meta tags plugin (cloud distribution only) { name: 'inject-twitter-meta',