How to correctly create a flow in SCSS for declaring margins , paddings like the tailwind?
An example:
Can someone provide example of how it should be best in scss to have a system for margins and paddings?
11 Replies
I use a map with the sizes I want, and then loop over it to create margin and padding utility classes.
I'm on mobile atm, but if you want an example I'll put one up tomorrow
@Kevin can you do that?
I was going to ask you directly, since I was assuming you were doing like that
It would be most appreciated
of course, you can use
left
, top
etc instead of the logical properties, and make shorter class names 🙂@Kevin
Can't I use like this below?
`
which is better of doing it you think ?
for sure 🙂
More automated, which is always good.
you'll just need some units tacked on
thanks so much it worked
im re-iterating on it now
@Kevin kevin is best way to quickly become good at these things constantly practicing right?
💯
since all of your keys and values are identical, you would probably use list instead of map.
so instead of
you would use this:
and you can loop over list as well..
That's a good point, I didn't even notice they were the same 😅
yes actually I made it like this at the end
it's the tailwindcss height palette i tried to re-imitate
#{$attribute}: calc(1rem * (#{$val} / 4));
than assigned like this
@Kevin hey kevin what font size do you prefer in VS code? Does it matter do you think for you so you can see all the code when font is small etc.Please don't bump your posts if you have found solutions. This is better asked in #off-topic or something.
Marking solved and closing*