Import Bootstrap LESS files

So, I am trying to import the bootstrap button.less file into my own project. However, in this case, I only want to include the css hazard element for danger and the main classes of buttons.

Something along the lines

.my_custom_button { .btn(); .btn-danger(); .btn-small(); } 

But I especially do not need all the other things. e.g. warning color class, etc. Currently used:

  @import "mixins.less"; @import "variables.less"; @import "buttons.less"; 

I am importing the entire css file into my project - is there a way to avoid this (I am a LESS noob) or is this just a smaller consequence?

+6
source share
2 answers

Now available in LESS 1.5

With LESS 1.5, you can import as a link (so you can use mixins without getting all the compiled code). Like this:

 @import (reference) "mixins.less"; @import (reference) "variables.less"; @import (reference) "buttons.less"; .my_custom_button { .btn(); .btn-danger(); .btn-small(); } 
+9
source

Hazard style:

 .btn-danger { .buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight); } 

So, in a word, you do not need the buttons.less file.

0
source

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


All Articles