line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Materialize; |
2
|
2
|
|
|
2
|
|
16250
|
use 5.010001; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
63
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
49
|
|
4
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
49
|
|
5
|
2
|
|
|
2
|
|
436
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
2
|
|
|
|
|
6630
|
|
|
2
|
|
|
|
|
11
|
|
6
|
2
|
|
|
2
|
|
1917
|
use Mojolicious::Plugin::AssetPack; |
|
2
|
|
|
|
|
95979
|
|
|
2
|
|
|
|
|
23
|
|
7
|
2
|
|
|
2
|
|
563
|
use File::Spec::Functions 'catdir'; |
|
2
|
|
|
|
|
556
|
|
|
2
|
|
|
|
|
105
|
|
8
|
2
|
|
|
2
|
|
9
|
use Cwd (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
640
|
|
9
|
|
|
|
|
|
|
our $VERSION = "0.9501"; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @DEFAULT_CSS_FILES = qw( materialize.css ); |
12
|
|
|
|
|
|
|
my @DEFAULT_JS_FILES = qw( materialize.js); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub asset_path { |
15
|
1
|
|
|
1
|
1
|
20
|
my ( $class ) = @_; |
16
|
1
|
|
|
|
|
62
|
my $path = Cwd::abs_path(__FILE__); |
17
|
1
|
|
|
|
|
4
|
$path =~ s!\.pm$!!; |
18
|
1
|
|
|
|
|
2
|
return $path; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub register { |
22
|
1
|
|
|
1
|
1
|
45
|
my ( $self, $app, $config ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
2
|
$app->plugin('AssetPack') unless eval { $app->asset }; |
|
1
|
|
|
|
|
12
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
50
|
|
|
1142
|
$config->{css} ||= [@DEFAULT_CSS_FILES]; |
27
|
1
|
|
50
|
|
|
7
|
$config->{js} ||= [@DEFAULT_JS_FILES]; |
28
|
1
|
|
50
|
|
|
5
|
$config->{jquery} //= 1; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
1
|
push @{ $app->static->paths }, $self->asset_path; |
|
1
|
|
|
|
|
16
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# TODO: 'bootstrap_resources.scss' |
33
|
1
|
50
|
|
|
|
2
|
if ( @{ $config->{css} } ) { |
|
1
|
|
|
|
|
4
|
|
34
|
1
|
|
|
|
|
6
|
$app->asset( 'materialize.css' => map {"/css/$_"} |
|
1
|
|
|
|
|
2
|
|
35
|
1
|
|
|
|
|
1
|
@{ $config->{css} } ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
1
|
50
|
|
|
|
3978
|
if ( @{ $config->{js} } ) { |
|
1
|
|
|
|
|
5
|
|
39
|
1
|
|
|
|
|
2
|
$app->asset( 'materialize.js' => map {"/js/$_"} @{ $config->{js} }, |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
__END__ |