added asset file mapping parameter to define files which are remapped af...#5
added asset file mapping parameter to define files which are remapped af...#5schmunk42 wants to merge 3 commits intomikehaertl:masterfrom
Conversation
… after package compression
|
Can you give an example use case here to better understand what problem this helps to solve? |
|
Here's the config of my current project: As you can see I, i.e. override |
PackageCompressor.php
Outdated
There was a problem hiding this comment.
Ok, so what this basically does: Prevent asset publishing from components, that don't use the package system. I don't quite like the name of that property. Should better be blockedScripts. And while i can see, why you chose the same format as for scriptMap (it makes the implementation below very easy), it's not very clean. E.g. what happens if you configure this to true or some URL?
This should rather be a list of script names:
public $blockedScripts = array(
'jquery-ui.min.js',
'jquery.fancybox-1.3.4.js',
);
Implementation will not change much, except that you can't use CMap::mergeArray() anymore.
PackageCompressor.php
Outdated
There was a problem hiding this comment.
Comment block messed up now? :)
|
Should be fixed, let me know if there are problems with the other branch. |
|
Would be an 1.1.0 btw. |
|
Before I start coding ... just some thoughts: To finalize this feature we should add another This would not register packages, when the compressor is off. But with the changes from my other PR |
There was a problem hiding this comment.
I think, we should update this docs once again, to be 100% precise. What about this (and please correct me if I'm wrong):
When compression is enabled, scripts defined in this array will be ignored if registered
through `CClientScript::registerScriptFile()`. This way you can package assets from
widgets that don't use the package system. For the time being this is for example the
case for CListView. So you could use:
'blockedScripts' => array(
'jquery.yiilistview.js',
),
'packages' => array(
'listview' => array(
'basePath' => 'zii.widgets.assets.listview',
'js' => array('jquery.yiilistview.js'),
),
'mypackage' => array(
'js' => array( ... ),
'depends' => array(
'listview',
),
),
),
...ter package compression.
Description and param name can still be improved ;)