[BUG] Top-level selectors may not contain the parent selector "&"
See original GitHub issueError 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:
- Created 2 years ago
- Reactions:28
- Comments:19 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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}')} {
Please, release hotfixes more regularly.
“Release early, release often” 😃