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 unikly
Created on: Mar 24, 2009
Last updated: 16 years ago

Downloads

show all