forked from Adleraci/adlerka.top
test inlining
This commit is contained in:
parent
1e82eb9ecd
commit
bf3a523ab2
@ -14,12 +14,12 @@ function inlineLocalStylesFromHref($inputString) {
|
||||
$cssContent = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $href);
|
||||
|
||||
// Replace url() declarations in the CSS content with inline data
|
||||
$cssContent = preg_replace_callback('/url\(["\']?(\/.*?)["\']?\)/i', function($urlMatch) {
|
||||
$cssContent = preg_replace_callback('/url\(["\']?\/(.*?)(?:[?#].*?)?["\']?\)/i', function($urlMatch) {
|
||||
// Extract the URL value
|
||||
$url = $urlMatch[1];
|
||||
|
||||
// Get the content of the external file specified in the url()
|
||||
$fileContent = file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url);
|
||||
$fileContent = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $url);
|
||||
|
||||
// Base64 encode the content for inline use
|
||||
$base64Content = base64_encode($fileContent);
|
||||
|
Loading…
Reference in New Issue
Block a user