Skip to content

fix(build): add :host support#170

Merged
mlmoravek merged 5 commits intooruga-ui:mainfrom
whiplashwebb:bug/correct-css-default
Jun 16, 2025
Merged

fix(build): add :host support#170
mlmoravek merged 5 commits intooruga-ui:mainfrom
whiplashwebb:bug/correct-css-default

Conversation

@whiplashwebb
Copy link
Copy Markdown
Contributor

@whiplashwebb whiplashwebb commented May 27, 2025

While fixing #168 I broke the docs. The docs display our components inside web components so it's essential that $enable-hosts functions and appends :host to everywhere bulma uses :root. If _root.scss doesn't have @use "bulma/sass"; then we don't extend all usages of :root. Strangely some usage does get extended, which makes no sense but is beside the point. The trouble is if we bring that @use back as it was before then we'll be bringing dark mode back with it for users of the separate install method like me.

My solution is to split _root.scss into a second file called _host.scss, which will contain the $enable-host logic and the tricky @use to support it. This file then gets included into .bulma-build.scss which is used in the combined method but not the separate method. This will solve for the docs, which need web components but don't care about dark mode, and users like myself, who need to avoid dark mode but don't care about web components. The only problem will be if we have users who need to use bulma without dark mode inside of a web component, but that's an edge case on an edge case, which i think will be fine.

Update: Turns out Bulma 1.0.4 has exactly what we need (jgthms/bulma#3906). New solution removes our $enable-host variable and replaces it with $theme-bulma-variables-host which mirrors $variables-host in Bulma. :host is enabled by default so functionally everything should remain the same for our users. _root.scss has also been modified to use this value.

@whiplashwebb whiplashwebb changed the title fix(build) : change import for correct bundle fix(build) : Refactor hosts support May 27, 2025
@whiplashwebb whiplashwebb changed the title fix(build) : Refactor hosts support fix(build) : Refactor :host support May 27, 2025
@mlmoravek
Copy link
Copy Markdown
Member

mlmoravek commented May 28, 2025

Have a look on the newest bulma v1.0.4 and this included PR
jgthms/bulma#3906

I think we can use $variables-host from bulma inside the theme instead of adding a new one. This should be the solution :)

@whiplashwebb
Copy link
Copy Markdown
Contributor Author

Have a look on the newest bulma v1.0.4 and this included PR jgthms/bulma#3906

I think we can use $variables-host from bulma inside the theme instead of adding a new one. This should be the solution :)

Nice find! That's perfect. I checked the open PRs and issues in Bulma but didn't dig through the recently merged stuff, so I didn't see this. With this PR we can solve for all use cases, even no-dark-mode/web-components. Let me do another version...

@whiplashwebb
Copy link
Copy Markdown
Contributor Author

@mlmoravek have another look. It's working well in local testing.

@mlmoravek mlmoravek added the bug Something isn't working label May 28, 2025
@mlmoravek mlmoravek changed the title fix(build) : Refactor :host support fix(build): add :host support Jun 16, 2025
@mlmoravek mlmoravek merged commit bc49764 into oruga-ui:main Jun 16, 2025
1 check passed
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