The core question you ask is
"How can I just use the bootstrap.less as reference for compiling?"
As of LESS version 1.5
For LESS 1.5 it is now possible to import a file purely as a reference. Like so:
@import (reference) 'bootstrap.less';
No actual code will output from that file as CSS, but all becomes available to use as mixins.
Original Answer (kept for context for all the comments)
[DISCLAIMER: it is uncertain if this would work as of 1.3.3, but this original answer I do believe has some usefulness in later versions as well. However, for truly getting what the OP wanted, the new capability in LESS 1.5 is recommended.]
Current versions of LESS (1.3.3) can accommodate this through the use of a namespace. Like so:
#bootstrapRef() {
@import: 'bootstrap.less':
}
input#submit{
#bootstrapRef > .btn;
#bootstrapRef > .btn-primary;
}
By making the namespace a mixin (the addition of the parentheses after the name), it will still import the file (I know of no way to access it externally without importing), but it should not compile the actual bootstrap code into your final css file output. What this technique should do is allow you access to bootstrap's classes, mixins, etc., through the namespace call #bootstrapRef >
, making it possible to use those in your own defined classes, etc.
I have not fully tested if there are any bugs to this, it should just work theoretically.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…