AW: [Catalyst] Compress HTML
Stefan
catalyst at s.profanter.me
Thu Sep 8 18:03:38 GMT 2011
Thanks Brian for the HTML::Packer link:
https://metacpan.org/module/HTML::Packer
I've now tested to implement the packer for each template parsing by
modifying the process function in my Catalyst::View::TT
(lib/MyApp/View/HTML.pm):
use HTML::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,
};
$html_packer->minify( $rendered, $opts );
$c->log->debug("Packed: " . $rendered);
$c->response->body($rendered);
}
But it seems that the html_packer has no effect, the debug output isn't
compressed.
Did I something wrong? Is the $opts hashref correct?
Thanks
Stefan
More information about the Catalyst
mailing list