3 Automatic Sass Snippets (hmphry.com)
over 7 years ago from Hmphry x, www.hmphry.com
over 7 years ago from Hmphry x, www.hmphry.com
Whats the benefit of using the $color-stack
to just namespacing your variables? For example:
$color-orange $color-orange-dark $color-orange-light
I have to admit ... I did wonder the same thing. That function did throw me for a loop when Sass already has the pre-built rgba function inside. If you just name your variables like Luke suggests and use that rgba function ... you don't have to go to the trouble of writing all the other code.
Don't fix what ain't broke if you know what I'm saying :).
Honestly? Some probably won't find any benefit. I find it beneficial because it fits a system I am accustomed to. Something about writing color(orange)
is nicer to me than $color-orange
.
I guess its down to personal preference at the end of the day. Whatever gets the job done eh :)
I enjoyed reading this, especially because of your helpful annotations.
Question on the color function: have you noticed any significant increase in compile time for this snippet? (Or really any of them)?
It would probably depend on how large your map was (and how many times you were calling the color() function). Just curious. :-)
Full disclosure, I use Gulp so everything is fast off the bat. Experiences will probably vary depending on the tool. That said, I had a predecessor to the font's mixin which I feel extended the compile time. I never tested it, though. Instead, I switched from ruby-sass to gulp-sass(which is libsass, if I recall correctly) and never looked back. That all said, I guess it depends on how often you will call it. I'm not sure how sass works, but if it's anything like JS, a variable should be faster inherently faster, but you may not notice the render speed until you called in 5000 times.
I will look into running some speed tests and get back to you in a few days.
This is superb! Really appreciate the depth you go into explaining your code and the over all presentation. This is a great resource. Well done!
Thanks Jono!
This is fantastic. Very clean and easy to maintain code. I'm currently using it for mylatest website.
Designer News
Where the design community meets.
Designer News is a large, global community of people working or interested in design and technology.
Have feedback?
Login to Comment
You'll need to log in before you can leave a comment.
LoginRegister Today
New accounts can leave comments immediately, and gain full permissions after one week.
Register now