AW: [Catalyst] Compress HTML

Stefan catalyst at
Sun Sep 11 08:41:13 GMT 2011

Hi Bill,

I'm using the PageSpeed Plugin (from Google) in Firebug for Firefox. This
plugin measures the page speed and gives you some hint, how you can increase
the performance of your site.

And Google said, that they will also evaluate your page speed/performance
for page ranking because they want to make a faster internet.


One of the hints hint was, to minify the HTML source. So I did it and now
I've managed to get 100 points of 100 J


I'm also compressing with gzip (done by Apache), which is also a hint on


I think the combination of both is the best, because gzip compresses the
whole file to send over the net. And minify reduces the content which the
browser has to parse (also removes comments).





use HTML::Packer;
use JavaScript::Packer;
use CSS::Packer;

my $html_packer = HTML::Packer->init();

sub process {
            my ( $self, $c ) = @_;
            my $rendered = $self->render($c, $c->stash->{template});
            my $opts = {
                        remove_comments => 1,
                        remove_newlines => 1,
                        html5 => 1,
                        do_javascript => 'best',
                        do_stylesheet => 'minify',
            $html_packer->minify( \$rendered, $opts );

List: Catalyst at
Searchable archive:
Dev site: 


-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Catalyst mailing list