I want to use regular expression to clean-up some CSS files.
I used a Friebug add-on, CSS Usage, to analyse some CSS from a jquery demo. Exporting the files, this add-on places 'UNUSED' at the front of a declaration and rule. Below is a sample of the output.
html #demo-config-menu li a:link,
UNUSED* html #demo-config-menu li a:visited {
padding:1px 8px 2px;
}
UNUSED#demo-config-menu li a:active,
#demo-config-menu li a:hover {
background-color:#f6f6f6;
}
UNUSED#demo-config-menu h4 {
font-size:13px; color:#666; font-weight:normal; border:0; padding-left:18px;
}
New to regular expressions, I have tried in vain to come up with search parameters for what I want.
- a way to search compound selectors for instances of UNUSED and the selector that follows, be it the first or second selector within a CSS rule (as in first two code samples);
- search for a complete declaration and rule as in the last code example
I have looked at tutorial on youtube and other sources. I can have success with anything up to and before ' {' but can not the search parameters to work beyond that.
Anyone have suggestions?