I want to add a parent ID to each css item in Twitter Bootstrap. I’ve found the RegEx tool, but I haven’t found the right code combination.
I have to do this because I can only target an area within the site I’m working on.
Essentially, I want to go from this:
.offset1{margin-left:100px;}
.row-fluid{width:100%;*zoom:1;} .row-fluid:before, .row-fluid:after{display:table;content:"";line-height:0;}
To this:
#parent .offset1{margin-left:100px;}
#parent .row-fluid{width:100%;*zoom:1;} #parent .row-fluid:before {display:table;content:"";line-height:0;}
Can anyone help?
thanks, Ross
Bootstrap is written with LESS, so you should be able to utilize it’s nesting rules for this:
There are a couple of .less files to do this to, but I think it’s still a pretty easy option. Note that I haven’t tried this myself, but it should work. 🙂
Obviously you’d have to download the LESS source and recompile it to CSS. It can be found on GitHub: https://github.com/twitter/bootstrap/
Constructing a regex for doing this to every CSS selector in Bootstrap seems like a pretty daunting task. You could potentially cause errors you won’t notice until much later.