Ok so lets say I have a variable $css that contains some CSS code. What I want to do is to add a certain text in front of each selector. So for example, the following code:
#hello, .class{width:1px;height:1px;background-color:#AAA;}
div{font-size:1px}
input, a, span{padding:4px}
Would be converted into:
#someId #hello, #someId .class{ ... }
#someId div{ ... }
#someId input, #someId a, #someId span{ ... }
I have been trying to use several explode()s. However, I haven’t been able to accomplish the task effectively. Any thoughts?
Thanks! JCOC611
Based on Jon’s suggestion I wrote the following code:
To see that it works see http://codepad.org/bqRd83gu