Skip to content

Load from a Config file

Junaid Atari edited this page Aug 24, 2016 · 2 revisions

Info: Before you start, make sure you have read the Quick Start guide.

I. Create a config file


  1. Create a new file: @app/config/cdn-config.php and open it in code editor.
  2. Now paste the following code:
return [
	'font-awesome' => [
		'css' => [
			[
				'font-awesome.min.css', // offline version
				'@cdn' => '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css', // online version
			]
		]
	]
];

II. Make use of config file


  1. Open @app/config/main.php in code editor.
  2. Add a new propery configs under cdn component like the following code:
// ...
'components' => [
	// ...
	'cdn' => [
		//...
		'configs' => [
        	// -------------------------
        	// List of config files
            // -------------------------

            // You can use Yii Alias too
			'@app/config/cdn-config.php',
            
            // or an absolute path
            // dirname(__FILE__) .'/cdn-config.php'
		],
        //...
	],
  // ...
],
// ...

III. Access component


/*
  ~ Register assets
*/
$cdn->get('font-awesome')->register();

Note: the red links below are pages yet to be created. Feel free to add them!

Overview documents

  • README: distributed with yii2cdn, contains a quick overview of yii2cdn's functionality, an example, and the license.
  • REFERENCE: Containing incomplete api class reference.

Quick Start

Configuration

Tutorials

Clone this wiki locally