Hi, just a quick question cause I can't find any resources online. I got the following SASS mixin to add my font-sizes in rem with fallback:
@mixin rem-font-size ($size) { font-size: $size + px; font-size: ($size / 10) + rem; /* =$size + px */ }
and it compiles to
font-size: 16px; font-size: 1.6rem; /* =$size + px */
which is pretty much I wanted. Except that I want the value of $size displayed in the comment as well. Any ideas how to solve that?
By referencing the variable like this: #{$var}, you can force Sass to output it in places where it usually wouldn't.
So you should be able to use.
@mixin rem-font-size ($size) { font-size: $size + px; font-size: ($size / 10) + rem; /* =#{$size + px} */ }
Awesome, works perfectly! Thanks @rosspenman. Do you know online resource where I can look something like that up myself next time? I could not find it in the official SASS reference that one is hard to read I think.
It actually is in the Sass documentation, but it isn't explained very well.
I just kind of guessed that it would work, and it did! :)
Ah it is even in there. Someone should definitely write a nicer doc for SASS.
Kaelig did: http://www.kaelig.fr/bettersassdocs/
Wow! That's cool!
Hi, just a quick question cause I can't find any resources online. I got the following SASS mixin to add my font-sizes in rem with fallback:
and it compiles to
which is pretty much I wanted. Except that I want the value of $size displayed in the comment as well. Any ideas how to solve that?
By referencing the variable like this: #{$var}, you can force Sass to output it in places where it usually wouldn't.
So you should be able to use.
Awesome, works perfectly! Thanks @rosspenman. Do you know online resource where I can look something like that up myself next time? I could not find it in the official SASS reference that one is hard to read I think.
It actually is in the Sass documentation, but it isn't explained very well.
I just kind of guessed that it would work, and it did! :)
Ah it is even in there. Someone should definitely write a nicer doc for SASS.
Kaelig did: http://www.kaelig.fr/bettersassdocs/
Wow! That's cool!