Defer javascript files by default
Prevent scripts blocking browser HTML parsing. The modern method instead of moving scripts to the end of the body tag as suggested in kanboard/kanboard#3829
This commit is contained in:
committed by
Frédéric Guillot
parent
539e2bfd6c
commit
7c0a1a5fbd
@@ -21,7 +21,7 @@ class AssetHelper extends Base
|
|||||||
*/
|
*/
|
||||||
public function js($filename, $async = false)
|
public function js($filename, $async = false)
|
||||||
{
|
{
|
||||||
return '<script '.($async ? 'async' : '').' type="text/javascript" src="'.$this->helper->url->dir().$filename.'?'.filemtime($filename).'"></script>';
|
return '<script '.($async ? 'async' : '').' defer type="text/javascript" src="'.$this->helper->url->dir().$filename.'?'.filemtime($filename).'"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user