Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use custom properties for sharing values between CSS and JavaScript #815

Merged
merged 11 commits into from Feb 16, 2022

Conversation

sebnitu
Copy link
Owner

@sebnitu sebnitu commented Feb 5, 2022

What changed?

This PR introduces global CSS variables. These allow for Vrembem to now set CSS variables in the core module which make them accessible in JavaScript modules.

This first implementation includes setting breakpoint custom properties that are then used in the Drawer component to handle breakpoints switching between modal and drawer modes.

CSS variables can optionally be output with a prefix using the core $prefix-variable sass variable which defaults to null. If set with a value (such as "vb-"), all CSS variables will be prefixed with "vb-" and a new CSS variable will be output:

:root {
  --vrembem-variable-prefix: vb-;
}

This is used in JavaScript modules that utilize CSS variables so they know how to look up a value using the correct property name.

This PR fixes #282

@sebnitu sebnitu marked this pull request as ready for review February 16, 2022 02:33
@sebnitu sebnitu merged commit f3ab859 into master Feb 16, 2022
@sebnitu sebnitu deleted the custom-properties branch February 16, 2022 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use CSS Variables for sharing between JavaScript
1 participant