sass-site/source/code-snippets/example-mixin-arbitrary-keyword-arguments.liquid
Jonny Gerig Meyer 1532553ef2
Merge branch 'main' into builtin-modules
* main:
  review
  Use JSON args for compatibility tag
  typo
  typo
  Use kwargs for {% compatibility %} tag.
  clearer example line breaks
  add missing @use
  silence sass warnings
  Do not autoformat md files
  combine more markdown blocks
  indentation for remainder of docs
  indentation for syntax docs
  indentation for style-rules docs
  indentation for cli docs
  indentation for breaking-changes
  Strip indentation from more paired shortcodes.
  Try out standard indentation
2023-06-02 17:36:10 -04:00

48 lines
885 B
Plaintext

{% codeExample 'mixin-arbitrary-kwargs' %}
@use "sass:meta";
@mixin syntax-colors($args...) {
@debug meta.keywords($args);
// (string: #080, comment: #800, variable: #60b)
@each $name, $color in meta.keywords($args) {
pre span.stx-#{$name} {
color: $color;
}
}
}
@include syntax-colors(
$string: #080,
$comment: #800,
$variable: #60b,
)
===
@use "sass:meta"
@mixin syntax-colors($args...)
@debug meta.keywords($args)
// (string: #080, comment: #800, variable: #60b)
@each $name, $color in meta.keywords($args)
pre span.stx-#{$name}
color: $color
@include syntax-colors($string: #080, $comment: #800, $variable: #60b)
===
pre span.stx-string {
color: #080;
}
pre span.stx-comment {
color: #800;
}
pre span.stx-variable {
color: #60b;
}
{% endcodeExample %}