Adding Critters to project removes media queries from external stylesheet
See original GitHub issueI’m using Critters in my webpack project with the following configuration:
new Critters({
mergeStylesheets: true,
inlineFonts: true,
})
I’m using this in combination with MiniCssExtractPlugin. When I add Critters to the plugin list (after MiniCssExtractPlugin and HtmlWebpackPlugin), critters seems to remove the content of media queries - the output still has the media queries but nothing is in them, which looks like this:
@media (max-width: 480px) {}
This breaks the styling and layout of my site.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Do CSS media queries have to be in an external CSS file?
Media queries are perfectly valid within <style> , they don't have to be within an external stylesheet. Make sure you include the viewport ......
Read more >node_modules/critters · master · Zahra Hassanjoulaee / Alice app ...
Critters is a plugin that inlines your app's critical CSS and lazy-loads the ... and media queries; Removes inlined CSS rules from lazy-loaded...
Read more >Creating a Future-Proof Responsive Email Without Media ...
This tutorial is all about creating a great experience in email clients which have no nested CSS or media query support whatsoever, using...
Read more >Beginner's guide to media queries - Learn web development
The CSS Media Query gives you a way to apply CSS only when the browser and device environment matches a rule that you...
Read more >A Webpack Plugin to inline Your Critical CSS & Lazy-load The Rest
"body": Move all external stylesheet links to the end of the document. "media": Load stylesheets asynchronously by adding media="not x" and removing once ......
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
I can also confirm that changing
pruneSource
fromtrue
(the default) tofalse
fixes the issue of CSS inside media queries being removed.I know, I was mentioning it in case it was something actionable; I don’t know the things you are building, not pruning could very well have a large effect there 😃
For the maintainers: I’ve also had this issue when pruneSource is on.