Skip to content

Instantly share code, notes, and snippets.

@Hypercubed
Created June 3, 2023 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hypercubed/c6b13039cd0dfd41787c941f5c6a17ae to your computer and use it in GitHub Desktop.
Save Hypercubed/c6b13039cd0dfd41787c941f5c6a17ae to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
@use 'sass:map';
$tokens: (
'red': #ff0000,
'blue': #00ff00,
'green': #0000ff
);
$mixins: ();
@mixin define-mixin($name) {
$internal-name: inline-#{unique-id()};
$mixins: map.set($mixins, $name, $internal-name) !global;
@at-root {
%#{$internal-name} {
@content;
}
}
}
@mixin apply-mixin($name) {
$internal-name: map.get($mixins, $name);
@extend %#{$internal-name};
}
@include define-mixin('test1') {
color: map.get($tokens, 'red');
background-color: map.get($tokens, 'green');
}
.element {
@include apply-mixin('test1');
}
.element {
color: #ff0000;
background-color: #0000ff;
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment