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
|
|
23287
|
use v5.16; # Mojolicious minimum version |
|
3
|
|
|
|
|
16
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
15
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
94
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1714
|
use Text::Minify::XS v0.6.2 (); |
|
3
|
|
|
|
|
1742
|
|
|
3
|
|
|
|
|
496
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 'v0.2.3'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub register { |
14
|
3
|
|
|
3
|
1
|
110
|
my ($self, $app, $conf) = @_; |
15
|
|
|
|
|
|
|
$app->hook( after_render => sub { |
16
|
3
|
|
|
3
|
|
38776
|
my ($c, $output, $format) = @_; |
17
|
|
|
|
|
|
|
|
18
|
3
|
100
|
|
|
|
10
|
return if $c->stash->{'mojox.no-minify'}; |
19
|
|
|
|
|
|
|
|
20
|
2
|
50
|
|
|
|
22
|
if ($format eq "html") { |
21
|
2
|
|
|
|
|
13
|
$$output = Text::Minify::XS::minify( $$output ); |
22
|
|
|
|
|
|
|
} |
23
|
3
|
|
|
|
|
26
|
}); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |