On Fri, Sep 9, 2011 at 1:14 AM, Stefan <catal...@s.profanter.me> wrote:

> > Guess you should pass a ref to $rendered to minify(), not the string
> itself.
>
> Yes!!! Thanks a lot! This did it. Here is the complete code for others:
>
Are you defalting/gzipping your content, too?

We don't have HTML comments in the markup, and our css and js is minified
and served statically (from a CDN).  Our load balancer does hardware
compression.  I've often wondered if the compressed size of the response
would be much different if we "packed" our markup first, and if the time to
"pack" each response would offset any gains in response size -- and more
specifically, client rendering time.

For us, it's mostly whitespace that would get packed, and that tends to get
compressed well.

Of course, this is really hard to measure w/o knowing your client's
connection in detail.  If concerned about your site it's best to attack
well-known areas of performance first.  This is a good reference:

http://developer.yahoo.com/performance/rules.html

Might also run your site through:

http://www.webpagetest.org/

>


>
> 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 );
>             $c->response->body($rendered);
> }****
>
> _______________________________________________
> List: Catalyst@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/
>
>


-- 
Bill Moseley
mose...@hank.org
_______________________________________________
List: Catalyst@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/

Reply via email to