Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing Bootstrap LESS files

So I'm trying to import the bootstrap button.less file into my own project. However in this case I only want the danger button css stuff to include and the core button classes.

Something along the lines of

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

But I don't particularly need all the other stuff. e.g. the warning colour class etc. Currently by using:

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

I'm importing the entire file css into my project - is there any way I can avoid this (I'm a LESS noob) or is this just a consequence of less?

like image 762
George Wilson Avatar asked Jun 08 '13 20:06

George Wilson


1 Answers

Now Available in LESS 1.5

As of LESS 1.5 you can do an import as just a reference (so you can use the mixins without getting all the code compiled). Like this:

@import (reference) "mixins.less";
@import (reference) "variables.less";
@import (reference) "buttons.less";

.my_custom_button {
  .btn();
  .btn-danger();
  .btn-small();
}
like image 170
ScottS Avatar answered Sep 21 '22 02:09

ScottS