Forum Moderators: open

Message Too Old, No Replies

Give your html files a trim

A neat feature from DWMX

         

le_gber

5:51 pm on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ever wonder how to save some bytes from your html pages? Make the files lighter? Smaller?

Using the search and replace tool you can easilly get rid of all the whitespace.

  • in the site view go to Edit >> Find and replace
  • in the box search for select source code and type a double space
  • in the replace with box type nothing
  • in the options select match case, deselect ignore whitespace differences, and select use regular expressions

    and off you go. All the indentation will be removed and if you play a little with the end - delete keys you will soon have a very compact html file.

    I saved over 30% for my test file >> it went from 11K to 8K (well 10.8K to 7.51K according to windows).

    If anybody knows a fastest way, please let me know.

    Leo

    ps if you want to go back in code view to edit some code, all you have to do is go in design view hit ctrl+a, ctrl+x and ctrl+v it will restore the code with indentation.
    ps2. make sure you test this on a test page before doing it for you whole site, you may have designed your pages in a way that you need the whitespaces

  • ncw164x

    6:04 pm on Nov 13, 2003 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    HTMLshrinker

    Does hundreds of pages in seconds without you having to do any work what so ever

    ncw164x

    Paddy

    2:58 pm on Nov 18, 2003 (gmt 0)



    And for those of us using Macs, there is a freeware program called HTML-Optimizer, available in various OS flavors, including X, which appears to do the same thing as HTML Shrinker. Haven't tried it yet, but it gets five cows at Tucows. It gives you a list of options to check off before it does its optimization. :)

    asquithea

    3:13 pm on Nov 18, 2003 (gmt 0)

    10+ Year Member



    I did this by hand on a large PHP search engine that generates long pages of dense markup. I quite literally cut 200K off the worst offenders (max search results selected). However, if you're serving pages using compression, it's doubtful it it makes an enormous difference to download time.