tags:

views:

36

answers:

1

I'm wondering if anyone knows of a script to clear all the properties from a css stylesheet, but leave the selectors.

For instance:

body {background: #000; font-size:10px; width:100%;}

becomes:

body {}

This would be done to the whole stylesheet. Thanks if anyone knows of a script to do this.

A: 
  • Deleting or renaming (breaking the link to) the entire CSS file will have the same effect.
  • The Web Developer addon for Firefox will allow you to disable CSS entirely for a page if you are interested in checking its contents without style information applied.
  • If you really must clean out the contents between brackets, a regular expression search-and-replace text editor will do the trick. UltraEdit has such a feature.* Search for {[\s\S]+} and replace with { }. Note, if your styles are across multiple lines, you will have to modify the regular expression to handle multiple lines.

*The example provided is using UltraEdit's "Unix-style" regular expression option, not the built-in one.

JYelton