I have found another extension created by Vince, but it is too complex and there are many bugs during my usage.
Description:
This extension just extend from {link: CClientScript} using few codes, it will allow you to automatically combine all script files and css files into a single (or several) script or css files. Basically this will reduce the HTTP calls for resources files by merging several resources files into a single (or more) files. It can automatically detect the required list of files, and generate a unique filename hash, so boldly ease of use.
Css Files:
CSS files are merged based on there media attribute, background images with a relative path in file can also be displayed correctly.
Script files:
Script files are merged based on their position, If you use the ‘CClientScript::POS_HEAD’ you will end up with a single file for all the script files you’ve used on that page. If you use ‘CClientScript::POS_HEAD’ and ‘CClientScript::POS_END’ for example then you’ll end up with two files for each page on that request, Since those resources are located in different positions.
I try it and it works perfect! But then I use it with optimizeScriptFiles I have some errors in my output javascript files. I tried to use JSMin instead JSMinPlus and in works without errors. Maybe you can change your code or make optimizeScriptFiles to be protected.