This file is not yet created when testing the style.
]);
// Do not save the compiled style, because the image path was unknown during the style generation.
- if ($this->styleTestFileDir && \file_exists($this->styleTestFileDir . '/style.css') && \file_exists($this->styleTestFileDir . '/style-rtl.css')) {
- \unlink($this->styleTestFileDir . '/style.css');
- \unlink($this->styleTestFileDir . '/style-rtl.css');
+ if ($this->styleTestFileDir) {
+ if (\file_exists($this->styleTestFileDir . '/style.css')) {
+ \unlink($this->styleTestFileDir . '/style.css');
+ }
+ if (\file_exists($this->styleTestFileDir . '/style-rtl.css')) {
+ \unlink($this->styleTestFileDir . '/style-rtl.css');
+ }
+ if (\file_exists($this->styleTestFileDir . '/style-preload.json')) {
+ \unlink($this->styleTestFileDir . '/style-preload.json');
+ }
\rmdir($this->styleTestFileDir);
}
$styleFilename = StyleCompiler::getFilenameForStyle($this->style);
\rename($this->styleTestFileDir . '/style.css', $styleFilename . '.css');
\rename($this->styleTestFileDir . '/style-rtl.css', $styleFilename . '-rtl.css');
+ if (\file_exists($this->styleTestFileDir . '/style-preload.json')) {
+ \rename($this->styleTestFileDir . '/style-preload.json', $styleFilename . '-preload.json');
+ }
\rmdir($this->styleTestFileDir);
}
// save compiled style
$defaultStyle = StyleHandler::getInstance()->getDefaultStyle();
- if ($defaultStyle !== null && $this->styleTestFileDir && \file_exists($this->styleTestFileDir . '/style.css') && \file_exists($this->styleTestFileDir . '/style-rtl.css')) {
+ if (
+ $defaultStyle !== null
+ && $this->styleTestFileDir
+ && \file_exists($this->styleTestFileDir . '/style.css')
+ && \file_exists($this->styleTestFileDir . '/style-rtl.css')
+ ) {
$styleFilename = StyleCompiler::getFilenameForStyle($defaultStyle);
\rename($this->styleTestFileDir . '/style.css', $styleFilename . '.css');
\rename($this->styleTestFileDir . '/style-rtl.css', $styleFilename . '-rtl.css');
+ if (\file_exists($this->styleTestFileDir . '/style-preload.json')) {
+ \rename($this->styleTestFileDir . '/style-preload.json', $styleFilename . '-preload.json');
+ }
\rmdir($this->styleTestFileDir);
}