Skip to content

Resolve SASS variables in selectors #1

@MorevM

Description

@MorevM

Target rule

Indirectly affects all rules

Current behavior

Currently, if a postcss.Rule selector contains a SASS variable, it is simply skipped in all rules.

Proposed behavior

SASS does not provide the ability to find out the value of a variable via any API, but the simplest scenarios can be calculated independently.

Examples

.some-component {
  $b: #{&};
  $link: #{$b}__link;

  &__element {
    // This selector is currently omitted, 
    // but it can generally be calculated quite easily.
    #{$link}:hover & {}
  }
}

Additional context

This probably needs to be done at the resolve-nested-selector stage, which all rules rely on in one way or another.

Extra info to consider

postcss/postcss-bem-linter#132

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions