From de6657592f529fc1b4050e689033fbaccc2747e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 28 Jul 2020 14:12:55 +0200 Subject: [PATCH] Add getFont() SCSS helper function --- .../lib/system/style/StyleCompiler.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 354ae05928..5f52db634b 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -274,6 +274,25 @@ class StyleCompiler extends SingletonFactory { $content .= $this->prepareFile($mixin); } + // getFont helper + $content .= <<<'EOT' +@function getFont($filename, $family: "/", $version: "") { + @if (1 == 1) { + @if ($family != "") { + $family: "families/" + $family + "/"; + } + @if ($version != "") { + $version: "?v=" + $version; + } + + @return "../font/" + $family + $filename + $version; + } + @else { + @return "../font/getFont.php?family=" + $family + "&filename=" + $filename + "&v=" + $version; + } +} +EOT; + // add google fonts if (!empty($variables['wcfFontFamilyGoogle']) && PACKAGE_ID) { $cssFile = FontManager::getInstance()->getCssFilename(substr($variables['wcfFontFamilyGoogle'], 1, -1)); -- 2.20.1