質問

Having searched around quite a bit to no avail I'm wondering if there is a way to assign JS and CSS files to a package with a conditional statement (i.e. <!--[if lte ie 7]>).

I would want something like this:

$packages['my-package'] = array(
    'basePath'=>'path.to.my-package',
    'css'=>array('css/style.css'),
    'js'=>array('js/file-to-load-conditionally.js'=>'<!--[if lte ie 7]>%s<![endif]-->')
);

foreach ($packages as $name => $package):
    Yii::app()->clientScript->addPackage($name, $package);
endforeach;

Is this already implemented, is about to be or does anyone know of another way to solve this issue?

Thanks in advance.

役に立ちましたか?

解決

This will not be supported by Yii. You can find the official statement here:

https://code.google.com/p/yii/issues/detail?id=1240#c21

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top