Last active
August 29, 2015 14:15
-
-
Save Kcko/77cb076ae4209623eb5f to your computer and use it in GitHub Desktop.
Module mixin - ukázka modulového přístupu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// _mixins.scss | |
@mixin module($color: grey, $duration: 0s, $border: null) { | |
color: $color; | |
transition: $duration; | |
border: $border; | |
} | |
// _component.scss | |
.element { | |
@include module(( | |
duration: .15s, | |
color: pink | |
)...); | |
} | |
// _mixins.scss | |
@mixin module2($options: ()) { | |
$configuration: map-merge(( | |
color: grey, | |
duration: 0s, | |
border: null | |
), $options); | |
color: map-get($configuration, color); | |
transition: map-get($configuration, duration); | |
border: map-get($configuration, border); | |
} | |
// _component.scss | |
.element { | |
@include module2(( | |
color: pink, | |
duration: .15s | |
)); | |
} | |
// http://www.sitepoint.com/using-sass-maps/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment