Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for CSS variables to be used with mixins #96

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kmonahan
Copy link

Fixes #78 . Allows for CSS variables to be set as the default value for a mixin or passed as a parameter.

Example:

@mixin set-color($color: var(--text-color)) {
  color: $color;
}

h3 {
  @include set-color;
}

h4 {
  @include set-color(var(--my-color));
}

Before, that resulted in:

h3 {
  color: va;
}

h4 {
  color: va;
}

After, that results in:

h3 {
  color: var(--text-color);
}

h4 {
  color: var(--my-color);
}

@@ -62,4 +62,4 @@ const getIncludeOpts = node => {
};

// match an opening parenthesis
const matchOpeningParen = '(';
const matchOpeningParen = /(?<!var)\(/;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some unit tests for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixins: CSS variables break when passed to mixin
2 participants