Earlier quoted context omitted.
I write vanilla CSS in 2020, but I suspect you're right in a "most people" sense. Still, I'm biased toward longer-lived approaches, meaning that whenever I can make it practical, I try to build with vanilla HTML, CSS, & JS with as few other technologies & libs as I practically can. Even my final HTML tends to be quite human-readable. Again, this won't work for many projects, but the point of it is long-term maintaina…
To be fair sass variables have been around much longer than css variables.
Show HN: A completely different way to write responsive, vanilla, CSS
41–48 of 48 posts
Re: Show HN: A completely different way to write responsive, vanilla, CSS
#42Re: Show HN: A completely different way to write responsive, vanilla, CSS
#43I know the docs need a little love but I think this has potential to be a game changer for writing responsive CSS. It has named breakpoints, lets you write DRY selectors, doesn't rely on JS or any sort of build step, and if you're already used to seeing --css-variables it's easier to read/maintain too. I've created a couple JS Bins if you want to play around with it a bit, resize the "output" pane to see it update: M…
The upsell on browser support is a little misleading. Sure, it’s 94% worldwide supported..but what isn’t mentioned is that the 6% is entirely IE11 and down and that the browser support numbers are inaccurate as they don’t include places like China or sorts where IE spin-offs are extremely common. A much better way to say it is “supports almost all browsers except IE” it’s accurate (as this does support almost all bro…
Re: Show HN: A completely different way to write responsive, vanilla, CSS
#44No build step should be the future of web development. The more steps that are added that require yet more tools to learn and more dependencies to maintain, the less inclusive and creative the web becomes. Hopefully we will one day be able to look back on this time period as an evil necessity.. I mean writing es6 and building to es5 is way better a lot of the time from a development perspective but on the face of it, its absurd and its why tooling gives people fatigue and turns away new promising developers for better programming languages.
I would definitely provide a way to download the css without npm first. Like big worm said, its about principalities.
Re: Show HN: A completely different way to write responsive, vanilla, CSS
#45This is awesome, build steps in CSS are absurd if you really sit there and think about what the purpose of the browser is compared to what it used to be.. No build step should be the future of web development. The more steps that are added that require yet more tools to learn and more dependencies to maintain, the less inclusive and creative the web becomes. Hopefully we will one day be able to look back on this time…
The CSS file is in the repo: https://github.com/propjockey/css-media-vars/blob/master/css...
and the readme links to this in an example link tag: https://unpkg.com/css-media-vars/css-media-vars.css
NPM is for convenience. Can't expect people to jump out of the build env all at once, so providing a vanilla CSS solution as a package is a good way to start the transition. IMO /shrug
Re: Show HN: A completely different way to write responsive, vanilla, CSS
#46So I think I understand how this works? Correct me if I'm wrong... So I made this example: https://jsbin.com/meqibawotu/1/edit?html,css,output We have two "toggle vars", `--is-hovered` and `--is-special`, which are triggered by a hover selector and a class, respectively, though they could be triggered by anything (like a media query or JS). The "false" value for the toggle is "initial", so at the top I set: div { --i…
YEP! Absolutely nailed it. That's what's up! I've been calling it Space Toggle. It does all kinds of stuff beyond toggle though - the whole world of conditional logic is possible. You can combine them in any way, &&, ||, !, it's all possible. You can see some more of my examples here: https://twitter.com/James0x57/status/1283912525248069632 https://twitter.com/James0x57/status/1283596399196680192 https://twitter.com/…
Re: Show HN: A completely different way to write responsive, vanilla, CSS
#47Earlier quoted context omitted.
YEP! Absolutely nailed it. That's what's up! I've been calling it Space Toggle. It does all kinds of stuff beyond toggle though - the whole world of conditional logic is possible. You can combine them in any way, &&, ||, !, it's all possible. You can see some more of my examples here: https://twitter.com/James0x57/status/1283912525248069632 https://twitter.com/James0x57/status/1283596399196680192 https://twitter.com/…
Can I ask, what’s the reason for using the keyword “initial”? As I understand it it could be any string that doesn’t accidentally create a valid value?
When I tried other strings (my name, "null", other CSS "words" like opacity) it broke.
I wonder if this is because the initial variable definition needs to be valid css in order to be replaced?
Re: Show HN: A completely different way to write responsive, vanilla, CSS
#48Earlier quoted context omitted.
YEP! Absolutely nailed it. That's what's up! I've been calling it Space Toggle. It does all kinds of stuff beyond toggle though - the whole world of conditional logic is possible. You can combine them in any way, &&, ||, !, it's all possible. You can see some more of my examples here: https://twitter.com/James0x57/status/1283912525248069632 https://twitter.com/James0x57/status/1283596399196680192 https://twitter.com/…
Can I ask, what’s the reason for using the keyword “initial”? As I understand it it could be any string that doesn’t accidentally create a valid value?
[0] https://twitter.com/James0x57/status/1283909866915074048
[1] https://www.w3.org/TR/css-variables-1/#invalid-variables