I have a custom.css
with these rules:
div#widget {background:red !important;}
div#widget2 {background:#f0f0f0;}
div#widget2:hover {background: rgb(10,20,30);}
These rules could be anywhere in the custom.css
file:
Example:
div#widget {background:red !important;}
.mainwrapper {background:blue;}
div#widget2 {background:#f0f0f0;}
p {font-size:12px;}
div#widget2:hover {background: rgb(10,20,30);}
Now my thought is to add another css-file to overrule existing custom.css rules like this:
div#widget {background:yellow !important;}
div#widget2 {background:#000000 !important;}
div#widget2:hover {background: #ffffff !important;}
Instead of adding a new custom css file with !important-rules I'm thinking... Is there a way to replace current custom.css rules with the new background-colors? Is this possible to achieve (in a secure way) in php?
(Now I'm creating a new css like this)
$fp = fopen( "newcustom.css", 'w');
fwrite($fp, $important_css);
fclose($fp);
UPDATE Clarification. I have a system where users can creates widgets. Widget code is created so the user could easily copy and paste it into his/her website. A reference to custom css is created for the user.
Now I'm updating the system... If I have to add new css file then the user would have to have to copy and paste a new widgetcode for the new css to work. If I could replace current custom.css then it would work "right away".