Thanks for your comment. You're right that this approach is also called Atomic CSS, and that it has been around for years.
I think you're also right that it was hard to make functional CSS work well with component-based styles.
But that's precisely the point of nanostyled: it makes it easy to use functional CSS in a component-based era.
As for your comment re: padding, I'm not sure I understand. Whether you can use shorthands or not just depends on whether your functional CSS framework has the necessary classes defined.
In tachyons, for example, this would work fine:
<Buttonpadding="pa3">Padding all around</Button><Buttonpadding="pv3 ph2">Lots of vertical padding, less horizontal padding></Button><Buttonpadding="pl1">Tiny bit of left padding only</Button>
Do not misunderstand me, technically speaking i like your library :) but i think also it "force" two completely different worlds to work together.
Using shorthand properties sometime allow you to write more concise css and save some bytes. Following my example, where all padding values are different, you can't use the padding shorthand (padding: 16px 8px 34px 32px) because you have to separate each value into longhand form, and it will become:
Why i don't like ACSS? Because in 2018, it can be mooore simple:
@keyframesfade{from{opacity:var(--startingOpacity,0),pointer-events:none;}to{opacity:var(--endingOpacity,1),pointer-events:auto;}}/* One animation to handle in-out */.FadeAnimation{--startingOpacity:0;--endingOpacity:1;--duration:300ms;--iterations:1;--easing:linear;--fill-mode:both;animation:fadevar(--duration)var(--itarations)var(--easing);animation-fill-mode:var(--fill-mode);}
I think it's important to remember that writing atomic css does not preclude you from writing your more simple example.
Clearly writing that animation as a bunch of separate atomic classes would be a bad idea, so in a real world app, you would write it exactly as you did. To me always writing functional css is not a hard and fast rule, just a good tool for preventing bloat and enabling consistency.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Mattia,
Thanks for your comment. You're right that this approach is also called Atomic CSS, and that it has been around for years.
I think you're also right that it was hard to make functional CSS work well with component-based styles.
But that's precisely the point of nanostyled: it makes it easy to use functional CSS in a component-based era.
As for your comment re: padding, I'm not sure I understand. Whether you can use shorthands or not just depends on whether your functional CSS framework has the necessary classes defined.
In tachyons, for example, this would work fine:
Do not misunderstand me, technically speaking i like your library :) but i think also it "force" two completely different worlds to work together.
Using shorthand properties sometime allow you to write more concise css and save some bytes. Following my example, where all padding values are different, you can't use the padding shorthand (
padding: 16px 8px 34px 32px
) because you have to separate each value into longhand form, and it will become:Tons of classes to write where it could be just:
This is just an example, think also animations handling. How many classes do you need to write this example with atomic CSS?
It become:
Why i don't like ACSS? Because in 2018, it can be mooore simple:
I think it's important to remember that writing atomic css does not preclude you from writing your more simple example.
Clearly writing that animation as a bunch of separate atomic classes would be a bad idea, so in a real world app, you would write it exactly as you did. To me always writing functional css is not a hard and fast rule, just a good tool for preventing bloat and enabling consistency.