line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Filter::Scss; |
2
|
2
|
|
|
2
|
|
18674
|
use 5.008001; |
|
2
|
|
|
|
|
6
|
|
3
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
41
|
|
4
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
53
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1025
|
use Template::Plugin::Filter; |
|
2
|
|
|
|
|
20540
|
|
|
2
|
|
|
|
|
113
|
|
7
|
2
|
|
|
2
|
|
15
|
use base qw( Template::Plugin::Filter ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
156
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1513
|
use CSS::Sass; |
|
2
|
|
|
|
|
33398
|
|
|
2
|
|
|
|
|
714
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
1
|
|
|
1
|
0
|
54647
|
my ($self) = @_; |
15
|
1
|
|
|
|
|
9
|
$self->install_filter('scss'); |
16
|
1
|
|
|
|
|
59
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub filter { |
20
|
1
|
|
|
1
|
0
|
107
|
my ($self, $text) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
my %options = (); |
23
|
1
|
50
|
33
|
|
|
12
|
if ($self->{ _CONFIG } && (ref($self->{ _CONFIG }) eq 'HASH')) { |
24
|
1
|
50
|
|
|
|
9
|
if ($self->{ _CONFIG }->{include_paths}) { |
|
|
50
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
$options{include_paths} = [$self->{ _CONFIG }->{include_paths}]; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ($self->{ _CONFIG }->{include_path}) { |
28
|
0
|
|
|
|
|
0
|
$options{include_paths} = [$self->{ _CONFIG }->{include_path}]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
|
|
|
4
|
if ($self->{ _CONFIG }->{output_style}) { |
32
|
1
|
50
|
|
|
|
5
|
$options{output_style} = SASS_STYLE_NESTED if uc($self->{ _CONFIG }->{output_style}) eq 'NESTED'; |
33
|
1
|
50
|
|
|
|
4
|
$options{output_style} = SASS_STYLE_COMPACT if uc($self->{ _CONFIG }->{output_style}) eq 'COMPACT'; |
34
|
1
|
50
|
|
|
|
4
|
$options{output_style} = SASS_STYLE_EXPANDED if uc($self->{ _CONFIG }->{output_style}) eq 'EXPANDED'; |
35
|
1
|
50
|
|
|
|
5
|
$options{output_style} = SASS_STYLE_COMPRESSED if uc($self->{ _CONFIG }->{output_style}) eq 'COMPRESSED'; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
9
|
my $sass = CSS::Sass->new(%options); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
19
|
my ($css, $stats) = $sass->compile($text); |
42
|
1
|
|
|
|
|
1719
|
return $css; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |