scriptset Register 'sets' of CSS and Javascript Per Controller Action and Manage From A Single Location

  1. Documentation
  2. Change Log

This extension is a very, very simple implementation of the CakePHP component 'Asset Manager'. You define sets of CSS and Javascript, then tell your controller actions to load whatever set is needed for that view.

This extension does not combine or compress any files, but works fine with the excellent 'extendedclientscript' that this extension is intended to complement (but not required).

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/components
Usage

It's super simple and almost not worth posting =)

First, define some sets within the release file itself:

	/*
	 * Define the CSS sets below
	 */
	private $cssSets = array (
		'groovy' => array (
			'/css/some.css',
			'/css/another.css',
			'/css/ie_hacks_boo.css'
		),	
			
		'setName2' => array (
			'/css/some.css',
			'/css/another.css',
			'/css/common.css',
			'/css/style.css'
		),		
	);

	/*
	 * Define the Javascript sets below
	 */	
	private $jsSets = array (
		'beans' => array (
		),
		
		'setName2' => array (
			'/js/jquery/jquery.js',
			'/js/uber.js',
			'/js/obtrusive.js',
			'/js/ruby_port.js'
		),
	);	

then, in a controller action, load whatever CSS and JS sets you need for that view (the first argument is the CSS set, the second is the JS set):

      $scriptSet = new ScriptSet;
      $scriptSet->loadSet('groovy', 'beans');

Change Log

April 21, 2009
  • Initial release.
0 0
1 follower
557 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Caching
Tags:
Developed by: drech
Created on: Apr 22, 2009
Last updated: 15 years ago

Downloads

show all