sass-site/source/code-snippets/_example-mixin-arbitrary-keyword-arguments.html.erb

42 lines
783 B
Plaintext
Raw Normal View History

2018-10-23 22:01:12 +02:00
<% example do %>
@mixin syntax-colors($args...) {
@debug keywords($args); // (string: #080, comment: #800, $variable: $60b)
2018-10-23 22:01:12 +02:00
@each $name, $color in keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
2018-10-23 22:01:12 +02:00
}
}
@include syntax-colors(
$string: #080,
$comment: #800,
$variable: #60b,
)
===
@mixin syntax-colors($args...)
@debug keywords($args) // (string: #080, comment: #800, $variable: $60b)
2018-10-23 22:01:12 +02:00
@each $name, $color in keywords($args)
pre span.stx-#{$name}
color: $color
2018-10-23 22:01:12 +02:00
@include syntax-colors($string: #080, $comment: #800, $variable: #60b);
===
pre span.stx-string {
color: #080;
}
2018-10-23 22:01:12 +02:00
pre span.stx-comment {
color: #800;
}
2018-10-23 22:01:12 +02:00
pre span.stx-variable {
color: #60b;
}
2018-10-23 22:01:12 +02:00
<% end %>