I have a script that updates a CSS file based upon some user input from an html form.
The script performs a str_replace and searches the CSS file for "tags". eg-
html,body {
background: {bgcolor} url(../images/bg.jpg) repeat-x;
color: {textcolor};
}
This works great but obviously breaks that CSS file. Originally it didn't matter but because of a new feaature in my project, I need to use that CSS file.
So I was wondering if there were any better alternatives to this? I was thinking maybe something like:
html,body {
background: #fff /*{textcolor*/ url(../images/bg.jpg) repeat-x;
color: #fff /*{textcolor*/;
}
So I could then use the comment symbols within the tag as well which means my CSS file isn't broken. Only problem is how would I replace/remove the hex as well?