* @since 2.0 */ class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ 'css/site.min.css', 'css/contents.min.css', 'css/chart.min.css' ]; public $js = [ 'js/chart.min.js', 'js/widget2chart.js', 'js/js.js', ]; public $depends = [ 'yii\bootstrap4\BootstrapAsset', 'yii\web\JqueryAsset', 'yii\web\YiiAsset' ]; public $jsOptions = [ 'defer'=>true ]; // public $cssOptions = [ // "rel"=>"preload", // "as"=>"style", // "onload"=>"this.rel='stylesheet'" // ]; public function init() { parent::init(); \Yii::$app->assetManager->bundles['yii\\web\\JqueryAsset'] = [ 'jsOptions' => ['position' => \yii\web\View::POS_HEAD, 'defer' => true], 'js' => ['jquery.min.js'] ]; \Yii::$app->assetManager->bundles['yii\\web\\YiiAsset'] = [ 'jsOptions' => ['position' => \yii\web\View::POS_HEAD, 'defer' => true] ]; } }