Is there a way to render block wrapper with @media
TangLiang opened this issue · comments
@media (min-width: 992px){
.footer__ajax-modal-dialog{
max-width: 1380px;
margin: 2.87rem auto !important;
}
.footer__ajax-modal{
padding: 0 !important;
overflow: hidden !important;
}
}
As i want just want to render the .footer__ajax-modal class from @media(min-width:992px) below are the php code.
PHP code:
$criticalCss = array();
$parser = new Parser(file_get_contents($sourceCssFile));
$cssDocument = $parser->parse();
$_select = '.footer__ajax-modal';
foreach ($cssDocument->getAllDeclarationBlocks() as $block) {
$selectors = array();
foreach ($block->getSelectors() as $selector) {
$selectors[] = $selector->getSelector();
}
if(in_array($_select,$selectors)){
$format = OutputFormat::create()
->indentWithSpaces(4)->setSpaceBetweenRules("\n");
$criticalCss[] = $block->render($format);
}
}
so the problem is,we can get the block but the @media is gone.anyone can help ?
thanks