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