This extension saves a lot of bytes and GET-requests!
All CSS files and all JS files get combined (this saves the browser from making unnecessary requests to the server).
Then these files get compressed (Google closure compiler for JS and Yahoo's YUI Compressor for CSS). This squeezes out the last possible byte by removing comments, whitespaces, renaming internal variables etc.
At last the JS file is put at the bottom of the page. This way the site is rendered and displayed, before the browser once again contacts the server to get the javascript file
Yii 1.1 or above
Just add these lines into your configuration file below under "components"
'clientScript' =>array( 'class' => 'ext.mtClientScript.mtClientScript', 'excludeFiles' => array('/js/jwysiwyg/jquery.wysiwyg.css', [...]), 'javaPath' => '/usr/bin/java', 'yuicPath' => '/home/peter/tools/yuicompressor-2.4.2.jar', 'closurePath' => '/home/peter/tools/closure.jar', ),
Get this extension strictly from GIT. So you also can improve it and send a pull request - and I'll merge it.
Total 2 comments
perhaps you should do $this->scriptFiles[self::POS_END] = array_merge( $this->scriptFiles[$pos], $this->scriptFiles[self::POS_END] ); b/c forexaple I include jquiry.ui.js in POS_END in you variant the order will be jquiry.ui.js jquery.js
Also I didn't find how you exclude js files, only css
seems you have mistake 'closurePath' => '/home/peter/tools/closure.jar', (should be compiler.jar)
I always get error JQuery is not defined, just like jquery.js is included after all other scripts.
Leave a comment
Please login to leave your comment.