AW: [Catalyst] Compress HTML

Marc Logghe logghe.marc at gmail.com
Thu Sep 8 18:10:33 GMT 2011


Guess you should pass a ref to $rendered to minify(), not the string itself.
Cheers
Op 8 sep. 2011 20:05 schreef "Stefan" <catalyst at s.profanter.me> het
volgende:
> 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 =3D HTML::Packer->init();
>
> sub process {
> my ( $self, $c ) =3D @_;
> my $rendered =3D $self->render($c, $c->stash->{template});
> my $opts =3D {
> remove_comments =3D> 1,
> remove_newlines =3D> 1,
> html5 =3D> 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
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110908/a4cb2=
144/attachment.htm


More information about the Catalyst mailing list