Comments on: Theming With Variables: Globals and Locals https://css-tricks.com/theming-with-variables-globals-and-locals/ Tips, Tricks, and Techniques on using Cascading Style Sheets. Mon, 15 Aug 2022 19:03:54 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: Jake https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1618160 Sun, 25 Mar 2018 23:54:48 +0000 http://css-tricks.com/?p=268217#comment-1618160 In reply to Jake.

Thanks for the replies regarding IE support. I just started learning how to use SASS anyway since my employer has talked about us starting to use it. I’m also going to look at that PostCSS too that Scott, Pavel, and basher all suggested. I just looked at cssnext page and it looks interesting, too.
Thanks!

]]>
By: Cliff Pyles https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617783 Wed, 21 Mar 2018 20:16:40 +0000 http://css-tricks.com/?p=268217#comment-1617783 In reply to Lars Willighagen.

Originally we ran into some issues with browser support when trying to declare a custom property, and using another custom property with a default value. I just did a quick check though, and I wasn’t able to reproduce the issue, so that might be a good way to go, but I would verify your target browsers play well with it first.

]]>
By: Sailor Moon https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617730 Wed, 21 Mar 2018 09:48:09 +0000 http://css-tricks.com/?p=268217#comment-1617730 Setting CSS variables to theme a design system can be tricky: if they are too scoped, the system will lose consistency. If they are too global, you lose granularity.

https://run3coolmath.io/

]]>
By: simonboyt https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617725 Wed, 21 Mar 2018 07:51:30 +0000 http://css-tricks.com/?p=268217#comment-1617725 Pavel, I totally agree with you. I was realized this approach on the https://webdesignblog.info/
Without this, I could not support ie9. CSSnext solves this task.

]]>
By: basher https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617676 Tue, 20 Mar 2018 13:14:19 +0000 http://css-tricks.com/?p=268217#comment-1617676 In reply to Jake.

And if you don’t want to use SASS or any other pre-processor, use PostCSS instead. E.g. CSSNext – http://cssnext.io/features/#custom-properties-var

]]>
By: Pavel https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617575 Mon, 19 Mar 2018 06:29:10 +0000 http://css-tricks.com/?p=268217#comment-1617575 In reply to Jake.

What about using PostCSS with http://cssnext.io for example?It seems to me that allows to help you use css variables even into ie9.That aproach requires just one additional step for compile your CSS in difference with native CSS variables.But allows to use all above described technics

]]>
By: Pietro L https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617559 Mon, 19 Mar 2018 01:46:18 +0000 http://css-tricks.com/?p=268217#comment-1617559 In reply to Jake.

Unless you want to be able to customize the theme in front end in real time, you don’t necessarily need css variables. The same concept can be applied to any css pre-processor with variables such as SASS and LESS. The whole idea is that you use variables to help keep consistency in the theme.

]]>
By: Bram z https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617547 Sun, 18 Mar 2018 16:56:34 +0000 http://css-tricks.com/?p=268217#comment-1617547 In reply to Jake.

Use SCSS (Sass). I don’t see Sass going anywhere soon, so it’s worth the investment.

]]>
By: Scott https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617531 Sun, 18 Mar 2018 06:18:08 +0000 http://css-tricks.com/?p=268217#comment-1617531 In reply to Jake.

Hi Jake, although the author has specifically used CSS variables here, you’ll notice that they stated these concepts work across pre-processors such as LESS, SASS, or PostCSS too. :)

]]>
By: Lars Willighagen https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617516 Sun, 18 Mar 2018 00:26:10 +0000 http://css-tricks.com/?p=268217#comment-1617516 Awesome! Quick question: Why are the fallback values not at the component variable definitions, but wherever they’re used?

]]>
By: robswiger https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617461 Sat, 17 Mar 2018 00:13:19 +0000 http://css-tricks.com/?p=268217#comment-1617461 In reply to Jake.

I’m not sure if this helps you out or not, Jake, but you can use this concept with SASS which should enable you to work within the bounds of IE11.

]]>
By: Jake https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617440 Fri, 16 Mar 2018 17:55:52 +0000 http://css-tricks.com/?p=268217#comment-1617440 caniuse.com says no support for IE11. Unfortunately, my company has said to us developers to support even IE11. They basically want almost anyone to have the same browsing experience.
I love this concept of CSS variables and theming but is there any way to use this or something similar or will I have to have fallbacks for IE thereby defeating the purpose.
I’d love to hear more on this subject.

]]>
By: Kye https://css-tricks.com/theming-with-variables-globals-and-locals/#comment-1617433 Fri, 16 Mar 2018 15:04:23 +0000 http://css-tricks.com/?p=268217#comment-1617433 We use exactly this pattern for our design system’s component library, but in CSS-in-JS (glamorous, in our case) rather than CSS/Sass/BEM. It’s worked well for us, and our consumers have appreciated the flexibility of customization.

For those interested: our global theme, a component’s local theme, and that component’s source.

I don’t agree that local theme variables must reference a global theme variable, though. While the exception, there are cases where a local variable can just be a direct value in our system, and I’d imagine that’s a shared need.

]]>