Skip to content

An empty variable used as a selector for a scope works, but is it an intentional language feature? #2911

Closed
@Giwayume

Description

@Giwayume

I wanted a variable that optionally adds an extra CSS class to scope some selectors, and this works:

This:

@scope-selector:;
@{scope-selector} {
  .red {
    color: red;
  }
}

Generates:

.red {
  color: red;
}

And this:

@scope-selector: ~".theme-class";
@{scope-selector} {
  .red {
    color: red;
  }
}

Generates:

.theme-class .red {
  color: red;
}

I'm not confident that the first example with @scope-selector:; is an intentional language feature, though. Can someone confirm this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions