# Uib-brand.css sometimes injected

**URL:** <https://discourse.nodered.org/t/uib-brand-css-sometimes-injected/78876>\
**Category:** General\
**Tags:** uibuilder\
**Created:** [1 June 2023 17:23 UTC](https://discourse.nodered.org/t/uib-brand-css-sometimes-injected/78876 "2023-06-01T17:23:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrmobley](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jrmobley/32/80286_2.png) [@jrmobley](https://discourse.nodered.org/u/jrmobley)\
**Post date:** [1 June 2023 17:23 UTC](https://discourse.nodered.org/t/uib-brand-css-sometimes-injected/78876/1 "2023-06-01T17:23:58Z")

</div>

I am using uibuilder with Svelte and I am providing my own stylesheet. Sometimes 'uib-brand.css' gets injected into the page and sometimes it does not. When it gets injected, it interferes with my own styling. From the documentation, and from the source code (excerpt below), I do not think it is supposed to be injected. If I set a breakpoint on the line that injects the style sheet, I see that `document.styleSheets.length` is 2 (as expected), so the injection code should not be running. I can only guess that this is a race condition and the style sheets have been loaded in the time it takes for the debugger to break and for me to look at the variable.

As a workaround, I will be adding more styling to override the 'uib-brand.css' elements that are causing me trouble.

From my 'index.html':

```css
<!-- Your own CSS -->
<link rel='stylesheet' type='text/css' href='./global.css'>
<link rel='stylesheet' type='text/css' href='./build/bundle.css'>

```

From 'uibuilder.iife.js':

```js
if (document.styleSheets.length >= 1 || document.styleSheets.length === 1 && document.styleSheets[0].cssRules.length === 0) {
  log("info", "Uib:start", "Styles already loaded so not loading uibuilder default styles.")();
} else {
  if (options && options.loadStylesheet === false)
    log("info", "Uib:start", "No styles loaded & options.loadStylesheet === false.")();
  else {
    log("info", "Uib:start", "No styles loaded, loading uibuilder default styles.")();
    this.loadStyleSrc(`${this.httpNodeRoot}/uibuilder/uib-brand.css`);
  }
}

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 June 2023 19:13 UTC](https://discourse.nodered.org/t/uib-brand-css-sometimes-injected/78876/2 "2023-06-01T19:13:14Z")

</div>

Hi and welcome to the community.

Thanks for highlighting this. It does seem like an odd race condition. I suspect that I was trying to be rather too clever when I included the auto-load. I will consider removing it completely in the next major release (since this would be potentially breaking - though I doubt anyone relies on it).

---

<div class="post-metadata">

**Author:** ![jrmobley](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jrmobley/32/80286_2.png) [@jrmobley](https://discourse.nodered.org/u/jrmobley)\
**Post date:** [1 June 2023 19:18 UTC](https://discourse.nodered.org/t/uib-brand-css-sometimes-injected/78876/3 "2023-06-01T19:18:10Z")

</div>

Thanks for the follow up and thank you for uibuilder!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 July 2023 19:18 UTC](https://discourse.nodered.org/t/uib-brand-css-sometimes-injected/78876/4 "2023-07-31T19:18:41Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
