Improve assets loading: remove http call to load task colors and async load of app.js

This commit is contained in:
Frederic Guillot
2015-06-23 20:47:46 -04:00
parent cdd2080fc0
commit 948ebb2424
7 changed files with 22 additions and 23 deletions

View File

@@ -16,9 +16,9 @@ class Asset extends \Core\Base
* @param string $filename Filename
* @return string
*/
public function js($filename)
public function js($filename, $async = false)
{
return '<script type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>';
return '<script '.($async ? 'async' : '').' type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>';
}
/**
@@ -48,4 +48,15 @@ class Asset extends \Core\Base
return '';
}
/**
* Get CSS for task colors
*
* @access public
* @return string
*/
public function colorCss()
{
return '<style>'.$this->color->getCss().'</style>';
}
}