I have a need to prefix Bootstrap classNames. I don't mean using .my-prefix .bs-class
as a wrapper, I mean actually prefixing BS classNames eg; .my-bs-class
.
I've explored doing this programmatically (using a Gulp process) however some of the selectors are a bit complex for me to safely convert, let alone treating mixin complexity.
So I wondered about extending BS with LESS functionality and while with simple use cases this works fine, eg;
// BS
.btn {
color:red;
}
// Prefixed BS
.my-btn {
&:extend(.btn);
}
Doing the same with nested selectors does not work as I'd hope, and I suspect it won't.
Taking this codepen: http://codepen.io/davewallace/pen/MJrMVj you can see a simple example of what I would like to happen, however the CSS output is:
.btn-group .btn,
.ui-btn-group .btn {
color: red;
}
as opposed to:
.btn-group .btn,
.ui-btn-group .ui-btn {
color: red;
}
Is what I am trying to achieve possible, if so, how?
Note: I'm open to alternative approaches to prefixing BS, however the technical debt incurred by modifying BS source is most undesirable, unless it is minimal.
EDIT: I have broadened this question to include any CSS pre-processors, so as to not restrict ourselves to LESS, if another technology can achieve it.