Yii Framework Forum: How To Use Customized Bootstrap Twitter? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Use Customized Bootstrap Twitter?

#1 User is offline   Wanderson 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 80
  • Joined: 20-February 09
  • Location:Rio de Janeiro, Brazil

Posted 30 January 2014 - 08:04 PM

How to use customized package downloaded in http://getbootstrap.com/customize/?
0

#2 User is offline   ORey 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,701
  • Joined: 20-April 09
  • Location:Moscow, Russia

Posted 30 January 2014 - 09:28 PM

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.
God is real unless declared as integer
0

#3 User is offline   Wanderson 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 80
  • Joined: 20-February 09
  • Location:Rio de Janeiro, Brazil

Posted 31 January 2014 - 07:30 AM

View PostORey, on 30 January 2014 - 09:28 PM, said:

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.
0

#4 User is offline   Wanderson 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 80
  • Joined: 20-February 09
  • Location:Rio de Janeiro, Brazil

Posted 24 March 2014 - 12:23 PM

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:
http://localhost/myapp


This is a bug in the framework or am not doing the right way?
0

#5 User is offline   ORey 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,701
  • Joined: 20-April 09
  • Location:Moscow, Russia

Posted 24 March 2014 - 12:37 PM

Hmmm.
Try to remove leading slash:
'css' => ['css/bootstrap.min.css', 'css/bootstrap-theme.css']
God is real unless declared as integer
0

#6 User is offline   Wanderson 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 80
  • Joined: 20-February 09
  • Location:Rio de Janeiro, Brazil

Posted 24 March 2014 - 12:47 PM

View PostWanderson, on 24 March 2014 - 12:23 PM, said:

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:
http://localhost/myapp


This is a bug in the framework or am not doing the right way?






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'] 
        ],
    ],
]

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users