Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I work with a web site where the front-end developers use FrontPage to develop the UI. I began wondering if there was a way I could improve/shrink down the HTML they were generating.

I found HTML::Clean and began testing it.

This is a very easy way to shrink the static HTML done on a web site.

I used a small test site one of the developers had put together to test with.

I was able to achieve a 10% shrinkage of the total size of the directory. In the scheme of things this is not a big savings, however, as I begin to move on to the larger web sites we have built I believe a 10% savings will begin to show improved download times for our customers.

Thanks to some of the other PM members I have put together this small script to demonstrate the abilities of HTML::Clean. While I have tested this on my own directories you may want to ensure that you have backups of your html files prior to running this script on your directories since this will over write the files in the running directory.

#!/usr/bin/perl -w use strict; use HTML::Clean; clean_file( $_ ) foreach glob "*.html"; sub clean_file { my ($filename) = shift; print "$filename is being cleaned!\n"; my $h = new HTML::Clean($filename,9) or die "Couldn't load $filena +me: $!\n"; $h->compat(); $h->strip(); my $myref = $h->data(); open(OUTPUT,">$filename") or die "Can't open $filename: $!"; print OUTPUT $$myref; close(OUTPUT); }

Edit kudra, 2002-02-26 Added paragraph breaks; added 'review' to title per ntc req

In reply to HTML::Clean Review by sheridan3003

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (10)
    As of 2019-09-19 12:40 GMT
    Find Nodes?
      Voting Booth?
      The room is dark, and your next move is ...

      Results (243 votes). Check out past polls.