-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmixins.html.md.eco
More file actions
39 lines (19 loc) · 1.13 KB
/
mixins.html.md.eco
File metadata and controls
39 lines (19 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
layout: "post"
title: "Mixins"
date: 2014-07-21
description: "How to use mixins: with and without parameters; with defaults; with an unknown number of mixin arguments"
---
## Mixin basics
Here is how to include a simple mixin, as you can see, the syntax is rather similar between the preprocessors.
<%- @code('Mixins', 'basic') %>
## Mixin parameters and parameter defaults
Mixins can receive one or multiple parameters.
You can even set defaults for each of the parameters. When a parameter has a default value, you don't need to set one when calling the mixin - see how we can omit the `thickness` parameter.
<%- @code('Mixins', 'params') %>
## Named parameters
If, for whatever reason, you want to set the parameters of a mixin in a particular order that is different that the one set in the mixin, you can do that by calling the mixin and explicitly state each of the parameters you're defining.
<%- @code('Mixins', 'params-named') %>
## Unknown number of parameters
If you want to have a mixin with a varying number of parameters, all CSS preprocessors allow you output all arguments like so:
<%- @code('Mixins', 'arguments') %>