assetsregistry Yii component to register your assets in one place.

  1. Requirements
  2. Usage
  3. Resources

Yii component to register your assets in one place.

Requirements

Requirements of using this extension (e.g. Yii 1.1 or above)

Usage

  • Place AssetsRegistryComponent.php into components
  • In layout
<?php app()->AssetsRegistry; ?>
  • In config/main.php
'components' => array(
 				'AssetsRegistry' => array(
 					'class' => 'AssetsRegistryComponent',

                     /* path to your config file (default config.assetsregistry) */
 					'config' =>'application.config.assetsregistry' 
 				),
  • Example of config file
return array(

	'layout' => array(

		'js' => array(
			            array('files' => array('test'), //js files
					          'url' => 'js',   
						      'pos' => CClientScript::POS_HEAD
					      ),
			),

			'css' => array()
),

		'users/view' => array(

		   'js' => array(
	 			   array('files' => array('test2', 'test3'),
						 'url' => 'js',
						 'pos' => CClientScript::POS_HEAD
						),

				  /* example with another position */
				  array('files' => array('test2', 'test3'),
						'url' => 'js',
						'pos' => CClientScript::POS_END
						),
			),

			'css' => array(
				     array('files' => array('test'),
						   'url' => 'css',
						   'addBaseUrl' => true),
			)
),
);

Resources

Dependency from globals.php (YiiBoilerplate)

Please, leave your suggestions in the comments

0 1
2 followers
158 downloads
Yii Version: Unknown
License: MIT
Category: Others
Developed by: Alexander Litvinov
Created on: Aug 1, 2013
Last updated: 10 years ago

Downloads

show all

Related Extensions