How to edit a variable and compile without using Bootstrap in Yii Framework?

I am using php Framework Yii and I want to use it in conjunction with Twitter Bootstrap platform.

I took exactly the same steps as here: http://www.cniska.net/yii-bootstrap/setup.html to configure it.

How to change the default values ​​for all colors, etc.? I changed it to "variables.less" and it compiled even successful bootstrap.less and style.less, but nothing has changed.

Sorry I'm such a newbie, but could you tell me which file I need to modify and compile to change the design?

+4
source share
3 answers

Assuming your files are less compiled, the colors should change in the compiled CSS files. At this point, you need to make sure that your HTML files are associated with a recently compiled CSS file.

+1
source

Like Yii-Bootstrap ver 1.2.0 , css files are taken from the path / in / bootstrap -extension / assets / css / folder, so any changes you make to the base .less files must be compiled and saved in this folder. Check this line in source :

Yii::app()->clientScript->registerCssFile($this->getAssetsUrl().'/css/bootstrap.css'); 

For instance:

  • Css extension folder: project name / protected / extensions / bootstrap / assets / css /
  • Base inactive files in the project name / protected / extensions / bootstrap / lib / bootstrap / less /
  • Make changes to the project name /protected/extensions/bootstrap/lib/bootstrap/less/variables.less:

     @white: #ffe;// changed from #fff 
  • Make a backup copy of the bootstrap.css source file just in case.

  • Compile the file protected / extensions / bootstrap / lib / bootstrap / less / bootstrap.less.
    Example (compiling the command line on the server side and in the folder with the project name):

     $lessc protected/extensions/bootstrap/lib/bootstrap/less/bootstrap.less > protected/extensions/bootstrap/assets/css/bootstrap.css 
  • Clear the cache in the browser, refresh to see the changes.

+3
source

I found out that it’s nice to copy files with a boot file to a smaller folder in the root directory and edit and compile them there. Thus, it would be easy to update the bootstrap framework.

In this smaller folder, I have a style.less file that imports bootstrap.less from the extensions / bootstrap / folder and my individual edited files. There I should pay attention when I use variables of other files, then I need to import fewer files that are defined by variables.

+1
source

Source: https://habr.com/ru/post/1413996/


All Articles