assetsregistry

Yii component to register your assets in one place.
2 followers

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

Be the first person to leave a comment

Please to leave your comment.

Create extension