1

I want to include bootsrtap3 only into a certain container. What I did, I downloaded bootstrap sources, went to \bootstrap-3.1.0\less renamed bootstrap.less to bootstrap2.less, created bootsrap.less, added to it

.tw-bs {
    @import "bootstrap2.less";
}

Which I found in some answer on stackoverflow I don't remember now. And which should've enclosed every rule in .tw-bs.

It worked for most rules, actually for all of them. But, when I looked closely at resulting .css files, I found some strange rules, like:

td.tw-bs .visible-print

or

.tw-bs .tw-bs .modal-footer:after

or

a.tw-bs .bg-primary:hover

That doesn't make sence, as .tw-bs should always be a parent. What I did wrong, and why this nonsence rules were generated?

zessx
  • 68,042
  • 28
  • 135
  • 158
dhblah
  • 9,751
  • 12
  • 56
  • 92

1 Answers1

3

Its a namespacing issue when using the & selector. Compile the bootstrap and import it.

kartikluke
  • 2,375
  • 1
  • 19
  • 32
  • can you please elaborate, how to do it? At first I'm compiling bootsrap, then I have bootsrap.css. What's then? I'm a bit new with less and was compiling bootsrap by following instructions on their website. So I'm not sure what should I do after creating new less file containing `.namespace-bs { @import (less) "css/bootstrap.css"; }` what should I do with my new `mybootrap.less` next? Compile it with less? How? From where? – dhblah Feb 14 '14 at 12:33
  • 1
    Compile the new file using WinLess or whatever method you generally use. You can keep bootstrap.css in the folder as it is unless you plan to change it. In your case change namespace to .tw-bs since the Bootstrap is already compiled you wont get those weird styles. – kartikluke Feb 14 '14 at 13:28