font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
- src: local('Open Sans Light'), local('OpenSans-Light'), url(getFont("OpenSans-Light.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans Light'), local('OpenSans-Light'), url(getFont("OpenSans-Light.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 300;
- src: local('Open Sans Light Italic'), local('OpenSans-LightItalic'), url(getFont("OpenSans-LightItalic.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans Light Italic'), local('OpenSans-LightItalic'), url(getFont("OpenSans-LightItalic.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
- src: local('Open Sans Regular'), local('OpenSans-Regular'), url(getFont("OpenSans-Regular.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans Regular'), local('OpenSans-Regular'), url(getFont("OpenSans-Regular.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
- src: local('Open Sans Italic'), local('OpenSans-Italic'), url(getFont("OpenSans-Italic.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans Italic'), local('OpenSans-Italic'), url(getFont("OpenSans-Italic.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
- src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'), url(getFont("OpenSans-SemiBold.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'), url(getFont("OpenSans-SemiBold.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 600;
- src: local('Open Sans SemiBold Italic'), local('OpenSans-SemiBoldItalic'), url(getFont("OpenSans-SemiBoldItalic.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans SemiBold Italic'), local('OpenSans-SemiBoldItalic'), url(getFont("OpenSans-SemiBoldItalic.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 700;
- src: local('Open Sans Bold'), local('OpenSans-Bold'), url(getFont("OpenSans-Bold.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans Bold'), local('OpenSans-Bold'), url(getFont("OpenSans-Bold.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 700;
- src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), url(getFont("OpenSans-BoldItalic.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), url(getFont("OpenSans-BoldItalic.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 800;
- src: local('Open Sans ExtraBold'), local('OpenSans-ExtraBold'), url(getFont("OpenSans-ExtraBold.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans ExtraBold'), local('OpenSans-ExtraBold'), url(getFont("OpenSans-ExtraBold.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 800;
- src: local('Open Sans ExtraBold Italic'), local('OpenSans-ExtraBoldItalic'), url(getFont("OpenSans-ExtraBoldItalic.woff2", "Open%20Sans", "1595938323")) format('woff2');
+ src: local('Open Sans ExtraBold Italic'), local('OpenSans-ExtraBoldItalic'), url(getFont("OpenSans-ExtraBoldItalic.woff2", "Open%20Sans", "1614334343")) format('woff2');
}
+woltlab-suite-preload:root { --woltlab-suite-preload: #{preload(
+ getFont("OpenSans-Regular.woff2", "Open%20Sans", "1614334343"),
+ $as: "font",
+ $crossorigin: true
+ )}; }
\ No newline at end of file
$css = $manifest['css'];
+ $preload = [];
+ if (isset($manifest['preload']) && \is_array($manifest['preload'])) {
+ $preload = $manifest['preload'];
+ }
+
+ $preloadRequests = "";
foreach ($manifest['font_files'] as $filename) {
if ($filename !== \basename($filename)) {
throw new \InvalidArgumentException("Invalid filename '" . $filename . "' given.");
),
$css
);
+
+ if (\in_array($filename, $preload)) {
+ $preloadRequests .= \sprintf(
+<<<'EOT'
+ --woltlab-suite-preload: #{preload(
+ %s,
+ $as: "font",
+ $crossorigin: true
+ )};
+EOT
+ ,
+ \sprintf(
+ 'getFont("%s", "%s", "%d")',
+ \rawurlencode($filename),
+ \rawurlencode($family),
+ TIME_NOW
+ )
+ );
+ }
}
+ $css .= "woltlab-suite-preload:root { ${preloadRequests} }";
+
\file_put_contents($this->getCssFilename($family), $css);
return $manifest;