cclientscriptminify Minify JavaScript and CSS stylesheets for views

  1. Documentation
  2. Change Log
Updated to support 1.0.4, now extending cClientScript rather than hacking!

This extension extends CClientScripts by utilizing Minify to minify JavaScript and CSS stylesheets for views.

Resources

Documentation

Requirements
  • Yii 1.0.3 or above
Installation
  1. Copy 'controller' and 'extensions' folder to your project's 'protected' folder
  2. Add following to your config/main.php with in 'components'=>array(, please check out the config/main.example.php
    //URL management
    'urlManager'=>array(
    	'urlFormat'=>'path',
    	'showScriptName'=>false,
    	'rules'=>array(
    		'minify/<group:[^\/]+>'=>'minify/index',
    	),
         ),
    //Customized CClientScript with Minify
    'clientScript'=>array(
    	'class'=>'application.extensions.CClientScriptMinify',
    	'minifyController'=>'/minify',
    ),
    
  3. Change any Minify options in controller/MinifyController.php
Usage

Use to following methods to register css or js files to be minified. ~~~ Yii::app()->clientScript->registerCSSFile($url, $media); Yii::app()->clientScript->registerScriptFile($url); ~~~ Please note, the $url needs to be absolute path from your document root (where the index.php script is), i.e. '/css/main.css', '/js/myscript.js' etc.

For more Minify tweaks please check out Minify Google Code Page

Change Log

March 24, 2009
  • R2565 supports Yii 1.0.4 (will not work on older version)
  • R2547 Initial release supports 1.0.3
6 1
8 followers
2 144 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Caching
Tags:
Developed by: unikly
Created on: Mar 24, 2009
Last updated: 14 years ago

Downloads

show all