$content = $callback($content);
- // write stylesheet
- \file_put_contents($filename . '.css', $content);
- FileUtil::makeWritable($filename . '.css');
-
- $content = $this->convertToRtl($content);
-
- // write stylesheet for RTL
- \file_put_contents($filename . '-rtl.css', $content);
- FileUtil::makeWritable($filename . '-rtl.css');
+ $this->writeCss($filename, $content);
}
/**
return $css;
}
+ /**
+ * Writes the given css into the file with the given prefix.
+ */
+ private function writeCss(string $filePrefix, string $css): void
+ {
+ \file_put_contents($filePrefix . '.css', $css);
+ FileUtil::makeWritable($filePrefix . '.css');
+
+ \file_put_contents($filePrefix . '-rtl.css', $this->convertToRtl($css));
+ FileUtil::makeWritable($filePrefix . '-rtl.css');
+ }
+
/**
* Returns the name of the CSS file for a specific style.
*