Skip to content

CSS variables are applied at root (HTML) scope #11

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
TheFoot opened this issue Sep 17, 2020 · 1 comment
Open

CSS variables are applied at root (HTML) scope #11

TheFoot opened this issue Sep 17, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@TheFoot
Copy link
Owner

TheFoot commented Sep 17, 2020

The CSS vars used by the component:

<style lang="scss">
:root {
	--color-highlight: 55, 114, 255;
	--color-highlight-faded: 215, 227, 255;
	--color-active: 150, 5, 5;
	--color-black: 0, 0, 0;
	--color-white: 255, 255, 255;
	--color-lightgrey: 240, 240, 240;
	--color-darkgrey: 76, 76, 76;
}
</style>

.. are applied to the host application, however - they aren't named with any reference to VDG - so there is potential for a clash.

Including them in a scoped doesn't work at all - not even withing local component development, hence why they exist in a globally scoped block atm.

Hopefully Vue will include support soon for a :host selector - to be applied to the component root: vuejs/vue-loader#1601

@TheFoot TheFoot added the bug Something isn't working label Sep 17, 2020
@TheFoot TheFoot self-assigned this Sep 17, 2020
@TheFoot
Copy link
Owner Author

TheFoot commented Sep 17, 2020

Option 1
Wait for :host support.

Option 2
Try using a :style binding on the component root element. This would mean no integration-side work needed. Could even be a prop to allow overriding of the component theme!

Option 2 sounds better methinks.. 🤔

@TheFoot TheFoot changed the title CSS variables not included in bundle CSS variables are applied at root (HTML) scope Sep 17, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant