Skip to content

Commit

Permalink
Bug fix on linking stylesheets
Browse files Browse the repository at this point in the history
  • Loading branch information
im-machakata committed Dec 8, 2022
1 parent 20588c1 commit 9b98080
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Groomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ final public function getHead(string $pageTitle = null, callable $cb = null) {
// @define('PG_TITLE', $this->getTitle());
printf("<title>%s</title>", $this->getTitle());
if ($this->headCss) :
printf("<style type=\"text/stylesheetsURI\">%s</style>", $this->headCss);
printf("<style type=\"text/css\">%s</style>", $this->headCss);
endif; ?>
</head>
<?php
Expand Down Expand Up @@ -1198,7 +1198,7 @@ final protected function printStylesheets($headCss) {

if (!$this->isWordPress()) :
if (!is_array($headCss)) {
printf("<link rel=\"stylesheet\" type=\"text/stylesheetsURI\" href=\"%s?ver=%s\" media=\"all\">", $headCss, $this->version);
printf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s?ver=%s\" media=\"all\">", $headCss, $this->version);
} else {
if (!isset($headCss['href'])) {
$headCss['href'] = $headCss['src'];
Expand All @@ -1210,15 +1210,15 @@ final protected function printStylesheets($headCss) {
if ($async) :
$stylesheetsURI .= sprintf("rel=\"preload\" href=\"%s", $headCss['href']);
else :
$stylesheetsURI .= sprintf("rel=\"stylesheet\" type=\"text/stylesheetsURI\" href=\"%s", $headCss['href'], $this->version);
$stylesheetsURI .= sprintf("rel=\"stylesheet\" type=\"text/css\" href=\"%s", $headCss['href'], $this->version);
endif;
if ($version) :
$stylesheetsURI .= sprintf("?ver=%s\" ", isset($headCss['version']) ? $headCss['version'] : $this->version);
else :
$stylesheetsURI .= sprintf("\" ");
endif;
if ($async) :
$stylesheetsURI .= 'as="headCss" onload="this.onload=null;this.rel=\'stylesheet\'">';
$stylesheetsURI .= 'as="css" onload="this.onload=null;this.rel=\'stylesheet\'">';
$stylesheetsURI .= sprintf("<noscript><link rel=\"stylesheet\" href=\"%s", $headCss['href']);
if ($version) :
$stylesheetsURI .= sprintf("?ver=%s", $this->version);
Expand All @@ -1241,8 +1241,8 @@ final protected function printFonts($font) {
if (is_array($font)) {
$font_name = $font['name'];
$html = sprintf("<link rel=\"preconnect\" href=\"%s\" crossorigin>", $font['preconnect'] ?? '//fonts.gstatic.com');
$html .= sprintf("<link rel=\"preload\" as=\"headCss\" href=\"//fonts.googleapis.com/css2?family=%s&display=%s\">", $font_name, $font['display'] ?? 'swap');
$html .= sprintf("<link rel=\"stylesheet preload prefetch\" href=\"//fonts.googleapis.com/stylesheetsURI?family=%s:%s\">", $font_name, $font['weight'] ?? '400');
$html .= sprintf("<link rel=\"preload\" as=\"css\" href=\"//fonts.googleapis.com/css2?family=%s&display=%s\">", $font_name, $font['display'] ?? 'swap');
$html .= sprintf("<link rel=\"stylesheet preload prefetch\" href=\"//fonts.googleapis.com/css?family=%s:%s\">", $font_name, $font['weight'] ?? '400');
print($html);
}
return $this;
Expand Down

0 comments on commit 9b98080

Please sign in to comment.