Commit 768ad805 authored by Georgi Mateev's avatar Georgi Mateev
Browse files

[BUGFIX] Minify JSON only if theckbox is active

parent bca21231
......@@ -875,7 +875,11 @@ class GenerateFilesAfterTcaSave {
$file = $sitePath . $folder . str_replace(
'#LANG#', $translatedData['sys_language_uid'], self::TEMPLATE_JSON_NAME
);
file_put_contents($file, json_encode($jsonDataArray, JSON_PRETTY_PRINT));
if ($minifyFiles) {
file_put_contents($file, json_encode($jsonDataArray));
} else {
file_put_contents($file, json_encode($jsonDataArray, JSON_PRETTY_PRINT));
}
GeneralUtility::fixPermissions($file);
}
......
......@@ -80,9 +80,7 @@ class AddCookieOptinJsAndCss implements SingletonInterface {
return '';
}
}
// we decode and encode again to remove the PRETTY_PRINT when rendering
// see https://gitlab.sgalinski.de/typo3/sg_cookie_optin/-/issues/118
return '<script id="cookieOptinData" type="application/json">' . json_encode(json_decode(file_get_contents($sitePath . $jsonFile))) .
return '<script id="cookieOptinData" type="application/json">' . file_get_contents($sitePath . $jsonFile) .
'</script><script src="/' . $file . '" type="text/javascript" data-ignore="1"></script>';
} {
// Old including from version 2.X.X @todo remove in version 4.X.X
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment