CSS has added a lot of new cool features such as custom properties and new functions. While these things can make our lives a lot easier, they can also end up interacting with preprocessors, like Sass, in funny ways.
Recently, CSS has added a lot of new cool features such as custom properties and new functions. While these things can make our lives a lot easier, they can also end up interacting with preprocessors, like Sass, in funny ways.
So this is going to be a post about the issues I’ve encountered, how I go around them, and why I still find Sass necessary these days.
If you’ve played with the new
max() functions, you may have ran into an error message like this when working with different units: “Incompatible units:
This is because Sass has its own
**min()**** function, and ignores the CSS `min()` function**. Plus, Sass cannot perform any sort of computation using two values with units that don’t have a fixed relation between them.
in units have a fixed relation between them, so Sass can figure out what’s the result of
min(20in, 50cm) and doesn’t throw an error when we try to use it in our code.
The same things goes for other units. Angular units, for example, all have a fixed relation between them:
1grad always compute to the same
deg values. Same goes for
1s which is always
1kHz which is always
1dppx which is always
1in which is always
96px. This is why Sass can convert between them and mix them in computations and inside functions such as its own
But things break when these units don’t have a fixed relation between them (like the earlier case with
And it’s not just different units. Trying to use
min() also results in an error. If I try something like
calc(20em + 7px), the error I get is, “
calc(20em + 7px) is not a number for
Want to develop a website or re-design using CSS Development? We build a website and we implemented CSS successfully if you are planning to **[Hire CSS Developer](https://hourlydeveloper.io/hire-dedicated-css-developer/ "Hire CSS Developer")**...
If you start using Sass, you never want to write CSS by hand again. If you're new to frontend development like me, maybe you heard or read that, but what is Sass, and is it really that amazing?
How to utilize the combined power of CSS and SASS variables. CSS Variables and SASS mixins are each potent on their own. With some creativity, we can make them work together towards more flexible and robust solutions.
The other day one of our students asked about possibility of having a CSS cheatsheet to help to decide on the best suited approach when doing this or that layout.
Learn some simple tips to accelerate your CSS by adopting Sass. Easily increase readability, reliability and reusability. Sass is awesome. It’ll save you some time and sanity.