Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS optimiser utility?

    Let's say I have 2 stylesheets (sheet1.css & sheet2.css), used on different pages, that contain the following:

    sheet1.css
    .pop_bg{background:#fff;border:1px solid #000;}

    sheet2.css
    .div_bg{background:#fff;border:1px solid #000;}

    Now, with copy&paste, I put these 2 sheets together in 1 sheet for all my pages (sheets_all.css)

    sheets_all.css
    .pop_bg{background:#fff;border:1px solid #000;}
    .div_bg{background:#fff;border:1px solid #000;}

    Does anyone know of a utility or an online service that can check sheets_all.css and say "Hey, classes pop_bg and div_bg are identical! Better remove one to reduce file size!"

    I have found several css optimiser services through google, but none of them checks for duplicate classes.

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,332
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Not sure if there is one. Did you try w3c css validator to see if there might be any errors?

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I did. No errors in the code.

    http://www.cssoptimiser.com/ will turn

    Code:
    .pop_bg{background:#fff;border:1px solid #000}
    .div_bg{background:#fff;border:1px solid #000}
    into
    Code:
    .pop_bg,.div_bg{background:#fff;border:1px solid #000}
    but it doesn't detect that div_bg and pop_bg are in fact copies of eachother.
    It looks like there is no such utility available anywhere. I could write one myself, in php, if I wasn't facing a deadline. So, maybe in a next project.


  •  

    Tags for this Thread

    Posting Permissions

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