How to use customized package downloaded in http://getbootstrap.com/customize/?
You can override paths to any package file by configuring assetManager component:
'assetManager' => [
'bundles' => [
'yii\web\JqueryAsset' => [
'sourcePath' => null,
'js' => ['//code.jquery.com/jquery-1.11.0-beta3.min.js'] // I think I'll take jQ from CDN
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => null,
'js' => ['/js/bootstrap.js'] // and this file was patched, so I use my own copy
],
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => null,
'css' => ['/css/bootstrap.min.css', '/css/bootstrap-theme.css'] // these are just for fun
],
],
],
PS. Bootstrap 3.1 is out btw.
Thanks for responding so quickly.
I tried the code below, but does not generate the correct path to the css.
'assetManager' => [
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => null,
'baseUrl' => '@web',
'css' => ['/css/bootstrap.min.css', '/css/bootstrap-theme.css']
],
],
],
Displayed result with the above code:
<link href="/css/bootstrap-theme.css" rel="stylesheet">
The correct should be:
<link href="myapp/css/bootstrap-theme.css" rel="stylesheet">
My application is running on the following url:
This is a bug in the framework or am not doing the right way?
Hmmm.
Try to remove leading slash:
‘css’ => [‘css/bootstrap.min.css’, ‘css/bootstrap-theme.css’]
Added ‘basePath’ => ‘@webroot’ and is now working.
'assetManager' => [
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => null,
'baseUrl' => '@web',
'basePath' => '@webroot',
'css' => ['css/bootstrap.min.css', 'css/bootstrap-theme.css']
],
],
]