-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9734980
commit c866f45
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
|
||
@mixin __rules($rules: ()) { | ||
@if not __is-map($rules) | ||
or not __every($rules, '__is-map') { | ||
@error 'Rules for _rules mixin must be key-value pairs, where value is a declaration map.'; | ||
} @else { | ||
@each $selector, $declarations in $rules { | ||
#{$selector} { | ||
@include __declare($declarations); | ||
} | ||
} | ||
} | ||
|
||
@content; | ||
} | ||
|
||
|
||
/// | ||
/// Includes a ruleset for each selector-declarations pair in the map. | ||
/// | ||
/// | ||
/// @access public | ||
/// @group Map | ||
/// @param {Map} $rules [()] The rules map. | ||
/// @output The rulesets for each selector key. | ||
/// @example scss | ||
/// $test-rules: ( | ||
/// '.foo': ( | ||
/// 'height': 50px, | ||
/// 'padding': 1rem 5rem | ||
/// ), | ||
/// '.bar .baz': ( | ||
/// 'width': 50px, | ||
/// 'margin': 2rem 6rem | ||
/// ) | ||
/// ); | ||
/// | ||
/// @include _rules($test-rules); | ||
/// | ||
/// // Output CSS: | ||
/// .foo { | ||
/// height: 50px; | ||
/// padding: 1rem 5rem; | ||
/// } | ||
/// | ||
/// .bar .baz { | ||
/// width: 50px; | ||
/// margin: 2rem 6rem; | ||
/// } | ||
|
||
@mixin _rules($args...) { | ||
@include __rules($args...); | ||
} | ||
|