Fix issue with AJAX framework load order on the frontend.

Partially reverts f4e50ddd1a in response to https://github.com/octobercms/october/pull/4285#issuecomment-513566437. Functionality can be re-added at a later date under an optional parameter added to the {% framework %} tag. Replaces https://github.com/octobercms/october/pull/4469
This commit is contained in:
Luke Towers 2019-07-29 16:30:14 -06:00
parent d910ff8fbe
commit 99777f5977
1 changed files with 6 additions and 24 deletions

View File

@ -25,7 +25,7 @@ class FrameworkNode extends TwigNode
public function compile(TwigCompiler $compiler)
{
$attrib = $this->getAttribute('name');
$includeExtras = strtolower(trim($attrib)) == 'extras';
$includeExtras = strtolower(trim($attrib)) === 'extras';
$compiler
->addDebugInfo($this)
@ -35,38 +35,20 @@ class FrameworkNode extends TwigNode
$compiler
->write("if (\$_minify) {" . PHP_EOL)
->indent()
->write("echo '<script async src=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework.combined-min.js\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<link rel=\"preload\" href=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework.combined-min.js\" as=\"script\" importance=\"low\">'.PHP_EOL;" . PHP_EOL)
->write("echo '<script src=\"' . Request::getBasePath() . '/modules/system/assets/js/framework.combined-min.js\"></script>'.PHP_EOL;" . PHP_EOL)
->outdent()
->write("}" . PHP_EOL)
->write("else {" . PHP_EOL)
->indent()
->write("echo '<script async src=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework.js\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<script async src=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework.extras.js\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<link rel=\"preload\" href=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework.js\" as=\"script\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<link rel=\"preload\" href=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework.extras.js\" as=\"script\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<script src=\"' . Request::getBasePath() . '/modules/system/assets/js/framework.js\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<script src=\"' . Request::getBasePath() . '/modules/system/assets/js/framework.extras.js\"></script>'.PHP_EOL;" . PHP_EOL)
->outdent()
->write("}" . PHP_EOL)
->write("echo '<link rel=\"stylesheet\" property=\"stylesheet\" href=\"'. Request::getBasePath()
.'/modules/system/assets/css/framework.extras'.(\$_minify ? '-min' : '').'.css\" importance=\"low\">'.PHP_EOL;" . PHP_EOL)
->write("echo '<link rel=\"preload\" href=\"'. Request::getBasePath()
.'/modules/system/assets/css/framework.extras'.(\$_minify ? '-min' : '').'.css\" as=\"style\" importance=\"low\">'.PHP_EOL;" . PHP_EOL)
->write("echo '<link rel=\"stylesheet\" property=\"stylesheet\" href=\"' . Request::getBasePath() .'/modules/system/assets/css/framework.extras'.(\$_minify ? '-min' : '').'.css\">'.PHP_EOL;" . PHP_EOL)
;
}
else {
$compiler->write("echo '<script async src=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework'.(\$_minify ? '-min' : '').'.js\" importance=\"low\"></script>
<link rel=\"preload\" href=\"'. Request::getBasePath()
.'/modules/system/assets/js/framework'.(\$_minify ? '-min' : '').'.js\" as=\"script\" importance=\"low\">'.PHP_EOL;" . PHP_EOL)
;
$compiler->write("echo '<script src=\"' . Request::getBasePath() . '/modules/system/assets/js/framework'.(\$_minify ? '-min' : '').'.js\"></script>'.PHP_EOL;" . PHP_EOL);
}
$compiler->write('unset($_minify);' . PHP_EOL);