yiizh/yii2-cdn

A CDN extension for Yii2.

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Maintainers

Package info

github.com/yiizh/yii2-cdn

Type:yii2-extension

pkg:composer/yiizh/yii2-cdn

Statistics

Installs: 160

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

0.1.1 2016-11-10 08:35 UTC

This package is auto-updated.

Last update: 2024-12-26 14:06:11 UTC


README

Packagist Packagist GitHub tag

A CDN extension for Yii2.

You can make your assets using CDN resources without changing your asset bundle code.

Install

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiizh/yii2-cdn "*"

or add

"yiizh/yii2-cdn": "*"

to the require section of your composer.json file.

Usage

1. Add a component

Add the following code to you config file @app/config/main.php:

// ...
'components' => [
    'cdn' => [
        'class' => 'yiizh\cdn\CDN',
        'assets' => [
            [
                'class' => 'yii\web\JqueryAsset',
                'js' => [
                    'http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js'
                ]
            ],
            [
                'class' => 'yii\bootstrap\BootstrapAsset',
                'css' => [
                    'http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css'
                ]
            ],
        ]
    ],
]
// ...

2. Add cdn to bootstrap

Add the following code to you config file @app/config/main.php:

// ...
'bootstrap' => ['log', 'cdn'],
// ...