question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Top-level selectors may not contain the parent selector "&"

See original GitHub issue

Error on local NPM build with v3.2.0

ERROR in ./resources/sass/admin/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Top-level selectors may not contain the parent selector "&".
  ╷
7 │   &.bg-#{$name} {
  │   ^^^^^^^^^^^^^^
  ╵
  node_modules\admin-lte\build\scss\mixins\_backgrounds.scss 7:3  background-variant()
  node_modules\admin-lte\build\scss\_colors.scss 7:3              @import
  resources\vendor\adminlte3\sass\parts\_miscellaneous.scss 9:9   @import
  resources\vendor\adminlte3\sass\adminlte.scss 25:9              @import

Environment:

  • AdminLTE Version: v3.2.0
  • Operating System: Windows 10

Additional informations I’ve fix this error by replacing, in build\scss\mixins_backgrounds.scss line 7:

&.bg-#{$name} {

by

.bg-#{$name} {

There may be other similar occurrences but I am not including all files in my project.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:28
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

26reactions
ihabhamadcommented, Feb 23, 2022

you can make changes in 1- build\scss\mixins_backgrounds.scss line 7: 2 - build\scss\mixins_toasts.scss line line 7: from &.bg-#{$name} { to #{if(&, '&.bg-#{$name}','.bg-#{$name}')} {

9reactions
forxercommented, Feb 8, 2022

Please, release hotfixes more regularly.

“Release early, release often” 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

sass - Base-level rules cannot contain the parent-selector ...
I'm flowing the ROR 4 tutorials , There is a chapter mentioned about Compiling Sass to CSS . I modified ...
Read more >
SASS "Top Level selectors May not Contain the Parent ...
The error message says, that "&" can not be used as a first/root selector because this char will be replaced by the parent...
Read more >
Sass error compiling Pro Stepper steppers.scss
Expected behavior Stepper Pro css would be included by default. ... .step-new-content, ^ Top-level selectors may not contain the parent selector "&".
Read more >
How to do SASS Grandparent Selectors | by Jake Wilson
The parent selector works perfectly for Pseudo-Classes but fail here because we need to select the .component element, which is the grandparent here....
Read more >
Looking Into the Future of Sass - David Walsh Blog
Instead of having styles.css:1 , you may now have ... error (Base-level rules cannot contain the parent-selector-referencing character '&').
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found