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.

Unclear if media queries should be preserved when they're in a css-file

See original GitHub issue

This issue originally started in gulp-inline-css.

I’ve played around with the tests in the project and if I change media-preserve.html to use <link rel="stylesheet" href="media-preserve.css" /> and move the CSS to that file then no CSS is included in the test output. If I try to add some media-query CSS to any other test that already uses external CSS files as part of the test, like in.html/file.css, and set the preserveMediaQueries: true option, I get the same result: no media query CSS is preserved.

To double check I added some media queries CSS as <style> in the HTML file I originally had issues with then those media queries are preserved, but the ones in my CSS file are ignored. Maybe this is by design? It’s not super clear from the documentation although reading it now I can imagine it’s technically correct. But since the main use case is Useful for emails according to the readme and it already supports applyLinkTags by default, so I assumed it would be preserved since that’s the only way to make media queries work in emails.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
flakesspcommented, Nov 19, 2015

Same for me. Essential +1.

1reaction
jonkempcommented, Oct 7, 2015

Interesting that it works in the style tag but not the link tag. I don’t know that this is broken so I’ll add it as a feature request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should the Bootstrap media queries be saved in a css file or a ...
I am using media queries for screen sizing, and I need help embedding the file into my HTML document. So, help? <link rel="stylesheet"...
Read more >
Where to put css media queries in a CSS file?
As for your question, it talks about media query placement having to say this about it, "Place media queries as close to their...
Read more >
Media Queries Level 4 - W3C
Media Queries allow authors to test and query values or features of the user agent or display device, independent of the document being...
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 >
preserveMediaQueries not being picked up? #23 - GitHub
The code is pretty straightforward: CSS (compiled from SCSS): . ... Unclear if media queries should be preserved when they're in a css-file...
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