I want to add attribute media="screen" in tag, all assets paths are defined in AppAsset.php file
public $css = [
'frontend/web/css/site.css',
'frontend/web/css/custome.css',
'frontend/web/css/font-awesome.css',
'frontend/web/css/jquery.bxslider.css',
];
i see no room for that, i have also checked documentation but found nothing.
<link href="/assets/597be7e4/css/bootstrap.css" rel="stylesheet" media="screen">
<link href="/assets/597be7e4/css/bootstrap.css" rel="stylesheet">
| Q | A
| ---------------- | ---
| Yii version | 2.0
| PHP version | 7.0.1
| Operating system | Ubuntu 14.04
Thanks !!!
there is the $cssOptions
so you can define
public $cssOptions = ['media' => 'screen'];
this will add media="screen" to all css files in this assetBundle.
If you want to have different media types i would suggest to create a seperate bundle per media and require the media bundles in the main bundle.
You can also specify options as
['frontend/web/css/site.css', 'media' => 'screen']
It's documented: http://www.yiiframework.com/doc-2.0/yii-web-assetbundle.html#$css-detail
Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.
We advise you to use our community driven resources:
If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.
_This is an automated comment, triggered by adding the label question._
thanks @Aradiv @samdark :)
Most helpful comment
You can also specify options as
It's documented: http://www.yiiframework.com/doc-2.0/yii-web-assetbundle.html#$css-detail