Chapter 5. Advanced Sass

In this chapter we'll look at some of the more advanced features of Sass. We'll take a comprehensive look at variables and in particular variable scope and using the !default and !global flags. We'll look at the problems which can arise when using local and global scope in mixins, functions, and selectors.

Then we'll look at creating a mixin which generates pure CSS arrows. To create this mixin we'll need to use extends and interpolation to dynamically use those extends from within our mixin. We'll also see how we can simplify checking for multiple values within an if statement using the index function.

We'll then create a mixin which will simplify writing media queries. We'll use the @content directive which allows us to ...

Get Mastering Sass now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.