mt-clientscript Combines all js files and css files and puts js files on the HTML bottom

  1. Requirements
  2. Usage
  3. Resources

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

Requirements

Yii 1.1 or above

Usage

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',
 ),

Resources

Get this extension strictly from GIT. So you also can improve it and send a pull request - and I'll merge it.

https://github.com/mintao/yii-ext-mtClientScript

3 0
6 followers
0 downloads
Yii Version: 1.1
License: (not set)
Category: Others
Developed by: mintao
Created on: Dec 23, 2010
Last updated: 13 years ago

Related Extensions