Skip to content

Commit 86bc46b

Browse files
Replace @charset inside files and put it at the beginning.
1 parent f456475 commit 86bc46b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/MinifyCssJsBundle/Templating/Helper/HeadLink.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ public function toString($indent = null) {
6666
foreach ($styles as $src) {
6767
$minifier->add(PIMCORE_WEB_ROOT.$src);
6868
}
69-
$minifier->minify(PIMCORE_WEB_ROOT.$file);
69+
$css = $minifier->minify();
70+
if (stripos($css, "@charset") !== false) {
71+
$css = '@charset "UTF-8";' . PHP_EOL . str_replace(['@charset "UTF-8"', "@charset 'UTF-8'"], ["", ""], $css);
72+
}
73+
file_put_contents(PIMCORE_WEB_ROOT.$file, $css);
7074
}
7175

7276
//append minified stylesheet

0 commit comments

Comments
 (0)