line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Text::Minify; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: remove HTML indentation on the fly |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
31844
|
use v5.16; # Mojolicious minimum version |
|
3
|
|
|
|
|
20
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
30
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
40
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
2284
|
use Text::Minify::XS v0.6.2 (); |
|
3
|
|
|
|
|
2236
|
|
|
3
|
|
|
|
|
591
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 'v0.2.4'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub register { |
14
|
3
|
|
|
3
|
1
|
155
|
my ($self, $app, $conf) = @_; |
15
|
|
|
|
|
|
|
$app->hook( after_render => sub { |
16
|
3
|
|
|
3
|
|
50716
|
my ($c, $output, $format) = @_; |
17
|
|
|
|
|
|
|
|
18
|
3
|
100
|
|
|
|
15
|
return if $c->stash->{'mojox.no-minify'}; |
19
|
|
|
|
|
|
|
|
20
|
2
|
50
|
|
|
|
28
|
if ($format eq "html") { |
21
|
2
|
|
|
|
|
16
|
$$output = Text::Minify::XS::minify( $$output ); |
22
|
|
|
|
|
|
|
} |
23
|
3
|
|
|
|
|
37
|
}); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |