Error: The string "", is not a valid CSS selector
See original GitHub issueHi,
I am using the CrittersPlugin
with the OptimizeCssAssetsPlugin
. When I add this the fallowing css
* {
box-sizing: border-box;
}
*::before,
*::after {
box-sizing: inherit;
}
it gets minified to:
*{box-sizing:border-box}:after,:before{box-sizing:inherit}
Notice it is now missing the *
selector and it only uses :after
and :before
.
If I remove the css rules for *::before
and *::after
or if I CrittersPlugin
from the plugins array it works fine, but when I include them I get the fallowing error:
ERROR in Error: The string "", is not a valid CSS selector
- nwmatcher.js:827 emit
[webpack-tutorial-boilerplate]/[nwmatcher]/src/nwmatcher.js:827:37
- nwmatcher.js:1529 select
[webpack-tutorial-boilerplate]/[nwmatcher]/src/nwmatcher.js:1529:11
- nwmatcher.js:1451 Object.first
[webpack-tutorial-boilerplate]/[nwmatcher]/src/nwmatcher.js:1451:14
- critters.js:117 Node.querySelector
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:117:28
- critters.js:359
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:359:37
- Array.filter
- critters.js:357
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:357:49
- critters.js:166
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:166:16
- Array.filter
- critters.js:162 walkStyleRules
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:162:29
- critters.js:161 walkStyleRules
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:161:18
- critters.js:355 Critters.<anonymous>
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:355:9
- new Promise
- critters.js:345 Critters.processStyle
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:345:12
- critters.js:254
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:254:76
- Array.map
- critters.js:254 Critters.$If_2
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:254:39
- critters.js:244 Critters.<anonymous>
[webpack-tutorial-boilerplate]/[critters-webpack-plugin]/dist/critters.js:244:34
Here is the dependency liist
"autoprefixer": "^9.0.1",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"clean-webpack-plugin": "^0.1.19",
"critters-webpack-plugin": "^1.1.0",
"css-loader": "^1.0.0",
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
"html-webpack-inline-svg-plugin": "^1.2.4",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.2",
"optimize-css-assets-webpack-plugin": "^4.0.3",
"postcss-loader": "^2.1.6",
"purgecss-webpack-plugin": "^1.2.0",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.2.7",
"url-loader": "^1.0.1",
"webpack": "^4.16.2",
"webpack-cli": "^3.1.0",
"webpack-merge": "^4.1.3"
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Invalid Selector Error using CSS Selector and href
I am trying to find an element using css selector and href with a partail link but I keep getting an invalid selector...
Read more >How to fix CSS selector errors - Element Not Found
On this page, you will learn how to fix the "Element not found" error caused by an incorrect CSS selector.
Read more >How to fix an InvalidSelectorException in Selenium - Reflect.run
In Java, when an invalid CSS or XPath selector is malformed, Selenium throws an InvalidSelectorException. This exception represents one of the ...
Read more >not() - CSS: Cascading Style Sheets - MDN Web Docs
If any selector passed to the :not() pseudo-class is invalid or not supported by the browser, the whole rule will be invalidated. The...
Read more >CSS Selectors Reference - W3Schools
Selector Example Example description
.class.intro Selects all elements with class="intro"
#id #firstname Selects the element with id="firstname"
* * Selects all elements
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 Free
Top 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
Thanks for the reports! It looks like this line is to blame: https://github.com/GoogleChromeLabs/critters/blob/c53df3d6b1f1b63b6374d79b0fa565c48e60a85f/src/index.js#L275
Happy to accept PR’s if anyone knows how to fix it, otherwise I’ll use your CSS as a test and find a fix @ThisNameWasTaken.
@reflog whilst not ideal, in the end I opted for
html-webpack-inline-source-plugin
Long term though, I’d love to use Critters - I’d be more than happy to help any of the active maintainers if they need it?