15Using More Mixin Argument Tricks

In some situations, you might want to set a default argument for a mixin. For example, in most cases, you want to have a default background. However, in some cases, you want to be able to set it yourself. In this situation, you can put a default value in the mixin, then you can change it if necessary.

You can set the default value to be null if necessary. In this case, when the mixin is compiled, it will leave out the value entirely—unless you specify one when including the mixin.

In the example, there is a default background and width for the mixin. In the header menu, it’s fine that the background uses the default color. However, you might want to overwrite the default width with a new value. You can just ...

Get Pragmatic Guide to Sass 3 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.