ezekel
(Dixunei)
May 2, 2015, 6:12pm
1
Hi, I just want to ask ,how can I include this in Appasset ?
//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css
Thank you in advance.
lukos
(Lukiebriner)
May 3, 2015, 7:30pm
2
I’m not sure you can but I don’t see what the value of doing that would be. The asset system is designed around publishing local assets and is helpful for bundling assets with a module or otherwise to program dependencies but in the case of CDN, I would just link them as usual.
Look into http://www.yiiframework.com/doc-2.0/guide-structure-assets.html and the source code for AssetManager to see whether it can resolve external URLs.
tampaphp
(tamaphp)
May 9, 2015, 1:21am
3
Lukos:
I’m not sure you can but I don’t see what the value of doing that would be. The asset system is designed around publishing local assets and is helpful for bundling assets with a module or otherwise to program dependencies but in the case of CDN, I would just link them as usual.
Look into http://www.yiiframework.com/doc-2.0/guide-structure-assets.html and the source code for AssetManager to see whether it can resolve external URLs.
In AppAsset.php, add your library to the $js property
I got this directly from Yii2’s documentation
http://www.yiiframework.com/doc-2.0/guide-structure-assets.html
js: an array listing the JavaScript files contained in this bundle. Note that only forward slash "/" should be used as directory separators. Each JavaScript file can be specified in one of the following two formats:
a relative path representing a local JavaScript file (e.g. js/main.js). The actual path of the file can be determined by prepending yii\web\AssetManager::$basePath to the relative path, and the actual URL of the file can be determined by prepending yii\web\AssetManager::$baseUrl to the relative path.
an absolute URL representing an external JavaScript file. For example, http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js or //ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js.