forked from Adleraci/adlerka.top
test inlining
This commit is contained in:
parent
98ca161624
commit
3183e3c346
@ -10,15 +10,15 @@ function inlineLocalStylesFromHref($inputString) {
|
|||||||
$cssContent = file_get_contents($cssFilePath);
|
$cssContent = file_get_contents($cssFilePath);
|
||||||
$cssDir = dirname($cssFilePath);
|
$cssDir = dirname($cssFilePath);
|
||||||
|
|
||||||
$cssContent = preg_replace_callback('/url\(["\']?(\/.*?|.*?)["\']?\)/i', function($urlMatch) use ($cssDir) {
|
// $cssContent = preg_replace_callback('/url\(["\']?(\/.*?|.*?)["\']?\)/i', function($urlMatch) use ($cssDir) {
|
||||||
$url = $urlMatch[1];
|
// $url = $urlMatch[1];
|
||||||
$absolutePath = $cssDir . '/' . $url;
|
// $absolutePath = $cssDir . '/' . $url;
|
||||||
$relativePath = ltrim(substr($absolutePath, strlen($_SERVER['DOCUMENT_ROOT'])), '/');
|
// $relativePath = ltrim(substr($absolutePath, strlen($_SERVER['DOCUMENT_ROOT'])), '/');
|
||||||
return 'url("' . $relativePath . '")';
|
// return 'url("' . $relativePath . '")';
|
||||||
}, $cssContent);
|
// }, $cssContent);
|
||||||
|
|
||||||
// Minify the CSS content
|
// Minify the CSS content
|
||||||
//$cssContent = minifyCss($cssContent);
|
$cssContent = minifyCss($cssContent);
|
||||||
|
|
||||||
return "<style>{$cssContent}</style>";
|
return "<style>{$cssContent}</style>";
|
||||||
}, $inputString);
|
}, $inputString);
|
||||||
|
Loading…
Reference in New Issue
Block a user