Skip to content

Commit

Permalink
Support the 'stylesheet/less' relation for less files.
Browse files Browse the repository at this point in the history
Also support other custom relations (but what for?).
  • Loading branch information
okonomiyaki3000 committed Oct 30, 2017
1 parent 91dcb79 commit 849d1f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/src/Document/Renderer/Html/HeadRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public function fetchHead($document)
// Generate stylesheet links
foreach ($document->_styleSheets as $src => $attribs)
{
// Find the relation
$relation = isset($attribs['relation']) ? $attribs['relation'] : 'stylesheet';
$relation = ($relation == 'stylesheet' && \JFile::getExt($src) == 'less') ? 'stylesheet/less' : 'stylesheet';

// Check if stylesheet uses IE conditional statements.
$conditional = isset($attribs['options']) && isset($attribs['options']['conditional']) ? $attribs['options']['conditional'] : null;

Expand All @@ -170,7 +174,7 @@ public function fetchHead($document)
$buffer .= '<!--[if ' . $conditional . ']>';
}

$buffer .= '<link href="' . $src . '" rel="stylesheet"';
$buffer .= '<link href="' . $src . '" rel="' . $relation . '"';

// Add script tag attributes.
foreach ($attribs as $attrib => $value)
Expand Down

0 comments on commit 849d1f7

Please sign in to comment.