SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Whitespace Tools

    Hi all,

    Can someone reccomend a tool to remove (most) whitespace from CSS files?

    I want it to be able to chage this:
    Code:
    selector {
       property: value;
       property: value;
       property: value;
    }
    
    selector, selector {
       property: value;
       property: value;
       property: value;
    }
    Into this:
    Code:
    selector {property: value;property: value;property: value}
    selector, selector {property: value;property: value;property: value}
    And then vise versa.

    Any tips appreciated.

    Thanks,
    Douglas
    Hello World

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,270
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi Doug,

    I don't know of any free tools but Top Style pro has a style sweeper which will do what you want (and more) but its about $80 I think.

    Paul

  3. #3
    SitePoint Zealot Tygger2512's Avatar
    Join Date
    Jul 2003
    Location
    Pittsburg, KS
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doug,

    I use a freeware tool called Absolute HTML Compressor to compress my xhtml and css files. When compressing, it removes the line breaks between CSS rules too, which is a little more than you wanted. It does not uncompress either, but you can do that for yourself using search & replace - i.e.
    Search for ; and replace with ;+carriage return
    Search for } and replace with }+carriage return

    I copy my source files into another directory called 'optimized' and run the compressor on this new directory. That way I don't overwrite my white space version, which is easy to edit.

    Hope this helps,
    Andy.
    Learn the Emotional Freedom Technique at www.as-if-by-magic.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •