}
$scss = "/*!\n\nstylesheet for '" . $styleName . "', generated on " . \gmdate('r') . " -- DO NOT EDIT\n\n*/\n";
- $scss .= $this->bootstrap();
+ $scss .= $this->bootstrap($variables);
foreach ($files as $file) {
$scss .= $this->prepareFile($file);
}
EventHandler::getInstance()->fireAction($this, 'compile', $parameters);
$scss = "/*!\n\nstylesheet for '" . $style->styleName . "', generated on " . \gmdate('r') . " -- DO NOT EDIT\n\n*/\n";
- $scss .= $this->bootstrap();
+ $scss .= $this->bootstrap($variables);
foreach ($this->getFiles() as $file) {
$scss .= $this->prepareFile($file);
}
$variables['style_image_path'] = "'../images/'";
$scss = "/*!\n\nstylesheet for the admin panel, generated on " . \gmdate('r') . " -- DO NOT EDIT\n\n*/\n";
- $scss .= $this->bootstrap();
+ $scss .= $this->bootstrap($variables);
foreach ($files as $file) {
$scss .= $this->prepareFile($file);
}
* Reads in the SCSS files that form the foundation of the stylesheet. This includes
* the CSS reset and mixins.
*/
- protected function bootstrap(): string
+ protected function bootstrap(array $variables): string
{
// add reset like a boss
$content = $this->prepareFile(WCF_DIR . 'style/bootstrap/reset.scss');
EOT;
}
- // add google fonts
- if (!empty($variables['wcfFontFamilyGoogle']) && PACKAGE_ID) {
- $cssFile = FontManager::getInstance()->getCssFilename(\substr($variables['wcfFontFamilyGoogle'], 1, -1));
- if (\is_readable($cssFile)) {
- $content .= \file_get_contents($cssFile);
- }
+ if (!empty($variables['wcfFontFamilyGoogle'])) {
+ $content .= $this->getGoogleFontScss($variables['wcfFontFamilyGoogle']);
}
return $content;
FileUtil::makeWritable($filePrefix . '-rtl.css');
}
+ /**
+ * Returns the SCSS required to load a Google font.
+ */
+ private function getGoogleFontScss(string $font): string
+ {
+ if (!PACKAGE_ID) {
+ return '';
+ }
+
+ $cssFile = FontManager::getInstance()->getCssFilename($font);
+ if (!\is_readable($cssFile)) {
+ return '';
+ }
+
+ return \file_get_contents($cssFile);
+ }
+
/**
* Returns the name of the CSS file for a specific style.
*