Fixed async loading on assets pipeline output

This commit is contained in:
Andy Miller 2016-04-28 10:20:35 -06:00
parent e4aad9797d
commit 12ca443cb4
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,9 @@
# v1.1.0-beta.3
## xx/xx/2016
1. [](#bugfix)
* Fixed handling of `{'loading':'async'}` with Assets Pipeline
# v1.1.0-beta.2
## 04/27/2016

View File

@ -1005,7 +1005,7 @@ class Assets
protected function isRemoteLink($link)
{
$base = Grav::instance()['uri']->rootUrl(true);
// sanity check for local URLs with absolute URL's enabled
if (Utils::startsWith($link, $base)) {
return false;
@ -1042,6 +1042,7 @@ class Assets
protected function attributes(array $attributes)
{
$html = '';
$no_key = ['loading'];
foreach ($attributes as $key => $value) {
// For numeric keys we will assume that the key and the value are the same
@ -1054,7 +1055,12 @@ class Assets
$value = implode(' ', $value);
}
$element = $key . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8', false) . '"';
if (in_array($key, $no_key)) {
$element = htmlentities($value, ENT_QUOTES, 'UTF-8', false);
} else {
$element = $key . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8', false) . '"';
}
$html .= ' ' . $element;
}
@ -1114,8 +1120,8 @@ class Assets
$file = $this->cssRewrite($file, $relative_dir);
}
$file = rtrim($file) . PHP_EOL;
$buffer .= $file;
$file = rtrim($file) . PHP_EOL;
$buffer .= $file;
}
// Pull out @imports and move to top