Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert media queries to style tag in the head of the document when the sources css makes use of them. #192

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ttcremers
Copy link

@ttcremers ttcremers commented Nov 4, 2019

css media queries were filtered out (which makes sense as they're not supported as inline style), now that more and more clients support style tags in the head it makes sense to include them there when the source css contains them.

src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
@ttcremers ttcremers requested a review from stof November 7, 2019 11:17
src/Css/Processor.php Outdated Show resolved Hide resolved
src/Css/Processor.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
src/CssToInlineStyles.php Outdated Show resolved Hide resolved
@ttcremers ttcremers requested a review from stof November 7, 2019 14:29
@adpeyre
Copy link

adpeyre commented Jul 28, 2021

Abandoned feature ? It would be useful.
My media queries are lost.

@superromeo
Copy link

superromeo commented Jan 17, 2023

It would be really useful.
Almost all clients support it.
Media query support

BTW, Emogrifier has it.

$docNode = $document->documentElement;
$head = $document->createElement('head');
$head->appendChild($style);
$docNode->insertBefore($head, $docNode->firstChild);
Copy link
Collaborator

@stof stof Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this broken if the HML has a <html> tag without a <head> tag ? An absent <head> tag does not only happen in partials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants