Skip to content

Instantly share code, notes, and snippets.

@azazqadir azazqadir/web.php
Created Nov 21, 2017

Embed
What would you like to do?
CDN Integration in Yii 2 App. Using CloudwaysCDN to call CSS file from CDN. Full article at: https://www.cloudways.com/blog/cdn-in-yii2/
// ...
'components' => [
   // ...
'cdn' => [
            'class' => '\yii2cdn\Cdn',
            'baseUrl' => defined ('YII2CDN_OFFLINE')
                ? 'http://localhost/yii2/cdn'
                : '//71265-358070-raikfcquaxqncofqfm.stackpathdns.com/cdn',
            'basePath' => dirname(__DIR__, 2) . '/cdn',
            'components' => [
                'font-awesome' => [
                    'css' => [
                        [
                            // local version
                            'font-awesome.min.css',
                            // cdn version
                            '@cdn' => '//71265-358070-raikfcquaxqncofqfm.stackpathdns.com/cdn/font-awesome/css/font-awesome.min.css',
                        ]
                    ]
                ]
            ],
        ],
 // ...
],
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.