Skip to content

fix: solve $enable-hosts adds dark styles when dark mode is removed#168

Merged
mlmoravek merged 6 commits intooruga-ui:mainfrom
whiplashwebb:bug/root-bulma
May 7, 2025
Merged

fix: solve $enable-hosts adds dark styles when dark mode is removed#168
mlmoravek merged 6 commits intooruga-ui:mainfrom
whiplashwebb:bug/root-bulma

Conversation

@whiplashwebb
Copy link
Copy Markdown
Contributor

@whiplashwebb whiplashwebb commented Apr 24, 2025

I needed to switch to the bulma version without dark mode using the separate method of theme config. I was able to use that style of config without issue and most of Bulma's dark mode disappeared, but some remained. It turned out that utils/_root.scss calls bulma/sass to support $enable-host, which is harmless when you use the combined method because you've already pulled in that code. However, when used in a separated build that file hasn't been pulled in as you're always doing something custom with Bulma (like removing dark mode), so the @use has the effect of pulling in Bulma code so :root can be extended. This brings in the version from bulma/sass which includes dark mode css variables.

To solve the problem I removed the @use, making the relationship implicit. Sass will still extend :root, but it will extend whatever :root has already been imported, either bulma/sass for the combined build or from a custom bulma build in the separated method. If you don't include bulma for some weird reason it will fail gracefully and extend nothing.

I also changed the separated example to make this easier to reproduce locally.

@mlmoravek mlmoravek added the bug Something isn't working label May 5, 2025
@mlmoravek mlmoravek changed the title Bug : $enable-hosts adds dark styles when dark mode is removed fix: solve $enable-hosts adds dark styles when dark mode is removed May 5, 2025
@mlmoravek mlmoravek merged commit 1fa85a6 into oruga-ui:main May 7, 2025
1 check passed
@mlmoravek
Copy link
Copy Markdown
Member

mlmoravek commented May 8, 2025

@whiplashwebb By removing the @use "bulma/sass"; from the root many variables seem missing now (see the docs now).

Now:
image

Before:
image

Any idea how we can fix this?

I think by the following code because of @use only whats in :root inside this file will be included in :host . That was the reason for @use "bulma/sass";.

  :host {
        @extend :root;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants