Math with interpolated variables?

Sass cannot perform arithemetic operations on strings, only concatenation. When you use interpolation, what you’ve created is a string that looks like a number: @debug type-of(#{10px}); // string @debug type-of(’10px’); // string @debug type-of(unquote(’10px’)); // string @debug type-of(10px); // number If you want a number, do not use interpolation and do not use quotes. For … Read more

Concatenating nested classes using SASS [duplicate]

& You can achieve this with the ampersand operator. Try: .a .c display: inline-block &.date width: 50px The ampersand is a placeholder for parent selectors. And if you don’t place a space after it in a nested selector it will output a concatenated selector (just what you want). DEMO Note: in deeper nested selectors & … Read more

Using a function in Sass is returning the string containing the name of the function rather than the result

Your function doesn’t exist. You must declare it (or import it from another file) before you use it. Sass does not throw errors for non-existent functions because they have a similar syntax to CSS functions. So it assumes that if it isn’t a Sass function that it must be a CSS function. Related: Test whether … Read more

Is Sass 3.3 compatible with Compass?

Compass 0.12 explicitly depends on Sass 3.2. Even if you have a newer version of Sass installed, it will still compile with 3.2. In order to use Sass 3.3 or later, you have to be using Compass 1.0 or later. Running the gem install command normally should get you the latest stable version. gem install … Read more

Why does Sass change the format of my colors?

How Sass treats colors varies depending on what version you’re using. But there are a few common behaviors: Sass will always maximize backwards compatibility whenever possible. Since keyword, hex, and rgba have the broadest browser support, all colors will be converted to one of those 3 formats, prioritizing towards either the keyword or hex. The … Read more