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

Base-level rules cannot contain the parent-selector-referencing character '&'. #1873

Closed
FWSimon opened this issue Oct 28, 2015 · 3 comments
Closed

Comments

@FWSimon
Copy link

FWSimon commented Oct 28, 2015

Hey guys,

after updating sass i got this error
Error: Base-level rules cannot contain the parent-selector-referencing character '&'.

The line it tells me is for this code

&:focus {
  outline: none;
}

What can it be? it worked before i updated sass

@chriseppstein
Copy link

This error has existed since 3.0 which was released in May 2010.

It's nonsensical to refer to a parent selector at the base-level of a stylesheet. Inferring that & should be the universal selector at the root level is not at all a safe assumption. Additionally, this is often indicative of a coding mistake. So we consider it an error.

If this was part of a mixin that is sometimes included at the base level and sometimes nested, you can write the mixin like this:

@mixin break-accessibility {
  #{if(&, "&", "*")}:focus {
    outline: none;
  }
}
@include break-accessibility;
.foo {@include break-accessibility;}

@FWSimon
Copy link
Author

FWSimon commented Oct 30, 2015

Ah thanks, just funny it first error out after i updated :)

@KEMBL
Copy link

KEMBL commented May 16, 2018

I've got that error when moved from "node-sass": "4.7.2" to "node-sass": "4.9.0", so if you need your working project urgently you can set up your previous version in devDependencies in package.json and continue to work.

mejackreed added a commit to projectblacklight/spotlight that referenced this issue Apr 20, 2020
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

No branches or pull requests

3 participants