[EXTENSION] minScript combine, minify, compress, cache
#1
Posted 26 July 2011 - 07:56 AM
Extension page
#2
Posted 27 July 2011 - 06:20 AM
1.0.1
- Replace header_remove function which introduced some issues
- Client-side cache will expire in 30 minutes now if no number is appended to the URL
- Optimizations to generateUrl
#4
Posted 29 July 2011 - 08:46 AM
1) I'm getting the following line generated in my template, but the link just shows roughly two shortish lines of garbage characters when I click on it:
<script type="text/javascript" src="/min/serve/g/jsGroup/0"></script>
2) Looking in /site/protected/runtime/minScript/ and I can see that the "cache" directory has been created but it is empty
I've added the following to the components array in my config file:
'minScript'=>array(
'class'=>'ext.minScript.components.ExtMinScript',
'groupMap'=>array(
'jsGroup'=>array(
'/themes/breathingroom/jvs/jquery-1.6.1.min.js',
'/themes/breathingroom/jvs/tooltip.js',
'/themes/breathingroom/jvs/jquery.cycle.all.js',
'/themes/breathingroom/jvs/jquery.cookie.js',
'/themes/breathingroom/jvs/init.js'
),
),
),
I also added this to my config file (though from the documentation I'm not sure if that's where it should actually go):
// ADDED FOR ExtMinScript extension
'controllerMap'=>array(
'min'=>'ext.minScript.controllers.ExtMinScriptController',
),
I'm using v 1.0.2 of minScript and Yii 1.1.8
Any thoughts or suggestions?
This post has been edited by sparkybarkalot: 29 July 2011 - 09:14 AM
#5
Posted 29 July 2011 - 05:40 PM
1.0.3
- Fixed a small bug in generateUrl
- Throw an exception if a defined file can't be found
- Change the format of exception messages
#6
Posted 29 July 2011 - 05:50 PM
thanks for reporting this...
1. could you please define "shortish lines of garbage characters", what exact output do you get ?
2. You define the files in the groupMap as paths and not as URL's. You need to define your files as relative paths or absolute paths... In your case use relative paths which means don't have a slash at the beginning of the path: themes/breathingroom/jvs/jquery-1.6.1.min.js
To help you with this, the new version 1.0.3 will throw an exception if a defined file doesn't exist...
Yes, you put the controllerMap in the right place... to get more info on using extensions you can read this: http://www.yiiframew...n/extension.use
sparkybarkalot, on 29 July 2011 - 08:46 AM, said:
1) I'm getting the following line generated in my template, but the link just shows roughly two shortish lines of garbage characters when I click on it:
<script type="text/javascript" src="/min/serve/g/jsGroup/0"></script>
2) Looking in /site/protected/runtime/minScript/ and I can see that the "cache" directory has been created but it is empty
I've added the following to the components array in my config file:
'minScript'=>array(
'class'=>'ext.minScript.components.ExtMinScript',
'groupMap'=>array(
'jsGroup'=>array(
'/themes/breathingroom/jvs/jquery-1.6.1.min.js',
'/themes/breathingroom/jvs/tooltip.js',
'/themes/breathingroom/jvs/jquery.cycle.all.js',
'/themes/breathingroom/jvs/jquery.cookie.js',
'/themes/breathingroom/jvs/init.js'
),
),
),
I also added this to my config file (though from the documentation I'm not sure if that's where it should actually go):
// ADDED FOR ExtMinScript extension
'controllerMap'=>array(
'min'=>'ext.minScript.controllers.ExtMinScriptController',
),
I'm using v 1.0.2 of minScript and Yii 1.1.8
Any thoughts or suggestions?
#7
Posted 29 July 2011 - 08:18 PM
#8
Posted 29 July 2011 - 10:49 PM
1.0.4
- Optimized error handling. Most errors will be logged now instead of throwing an exception.
#9
Posted 01 August 2011 - 09:00 AM
Thanks so much. It was indeed a path issue as you mention in #2. I removed the leading slash and it started working immediately. Thanks again for your work on this... it's really slick.
#10
Posted 01 August 2011 - 09:40 AM
you're welcome, thanks for the nice words and reporting back
sparkybarkalot, on 01 August 2011 - 09:00 AM, said:
Thanks so much. It was indeed a path issue as you mention in #2. I removed the leading slash and it started working immediately. Thanks again for your work on this... it's really slick.
#11
Posted 04 August 2011 - 05:03 AM
thanks in advance.
#12
Posted 04 August 2011 - 08:45 AM
spartans, on 04 August 2011 - 05:03 AM, said:
thanks in advance.
#13
Posted 05 August 2011 - 06:57 AM
1.0.5
- Code optimizations
- Improve server-side caching functionality
- Optimized error handling
#14
Posted 09 August 2011 - 02:57 AM
i.e.
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$url=$this->baseUrl.'/jquery.bookmark.min.js';
$cs->registerScriptFile($url,CClientScript::POS_HEAD);
#16
Posted 09 August 2011 - 04:33 PM
what you basically need to do is define the files in the minScript groupMap, for example:
return array(
...
'components'=>array(
'minScript'=>array(
'class'=>'ext.minScript.components.ExtMinScript',
'groupMap'=>array(
'js'=>array(
'path/to/jquery.bookmark.min.js',
...
),
),
),
),
);
and then before the extension registers the file you will need to generate the scriptMap, like so:
Yii::app()->minScript->generateScriptMap('js');
spamec, on 09 August 2011 - 02:57 AM, said:
i.e.
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$url=$this->baseUrl.'/jquery.bookmark.min.js';
$cs->registerScriptFile($url,CClientScript::POS_HEAD);
#17
Posted 10 August 2011 - 03:07 AM
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendors'; $this->baseUrl = Yii::app()->getAssetManager()->publish($dir);
Summarizing, I dont have path, just filename...
#18
Posted 10 August 2011 - 04:33 AM
so if u have files in extensions folder and those get published, just add following path to groupMap: Yii::getPathOfAlias('ext.blabla.vendors').'/jquery.bookmark.min.js'
spamec, on 10 August 2011 - 03:07 AM, said:
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendors'; $this->baseUrl = Yii::app()->getAssetManager()->publish($dir);
Summarizing, I dont have path, just filename...

Help













