jonkemp / jonkemp/inline-css

Media queries inside extraCss option can't be preserved

Open
#26 5 comments 0 reactions 0 assignees View on GitHub
feature request help wanted
Dominant language
JavaScript
Stars
438
Forks
77
PR merge metrics
No merged PRs in 30d

Description

If media query CSS is passed into the `extraCss` option and `preserveMediaQueries` is `true`, or if CSS is added through a `` tag, the media query-specific CSS isn't preserved in the HTML output.

[Here's a small test case.](https://tonicdev.com/56aefb716c5d650c000b7384/56bb6d1b1c6cc30c00905fea)

The use case for working with `applyLinkTags` is using inline-css in a basic web development workflow, where you have separate HTML and CSS files, and some CSS is inside of media queries and needs to be preserved in the inlined HTML.

The use case for working with `extraCss` is running inline-css in the browser, where we're avoiding having to read or write from a filesystem. So instead of using `` tag replacement, all of the CSS to be inlined is passed through `extraCss`.

Ideally the media query CSS in `extraCss` can be dropped into a `` tag in the final output. I can think of a workaround, but it would be nice if the library could handle it.

Also an FYI, version 2 of [Foundation for Emails](http://foundation.zurb.com/emails) (formerly Ink) will be using this library to inline CSS :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.