line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Filter::Scss; |
2
|
2
|
|
|
2
|
|
58602
|
use 5.008001; |
|
2
|
|
|
|
|
14
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
33
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
815
|
use Template::Plugin::Filter; |
|
2
|
|
|
|
|
10082
|
|
|
2
|
|
|
|
|
58
|
|
7
|
2
|
|
|
2
|
|
13
|
use base qw( Template::Plugin::Filter ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
118
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
867
|
use CSS::Sass; |
|
2
|
|
|
|
|
21208
|
|
|
2
|
|
|
|
|
560
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
1
|
|
|
1
|
0
|
49224
|
my ($self) = @_; |
15
|
1
|
|
|
|
|
8
|
$self->install_filter('scss'); |
16
|
1
|
|
|
|
|
53
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub filter { |
20
|
1
|
|
|
1
|
0
|
89
|
my ($self, $text) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
2
|
my %options = (); |
23
|
1
|
50
|
33
|
|
|
10
|
if ($self->{ _CONFIG } && (ref($self->{ _CONFIG }) eq 'HASH')) { |
24
|
1
|
50
|
|
|
|
5
|
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
|
|
|
|
5
|
$options{output_style} = SASS_STYLE_COMPACT if uc($self->{ _CONFIG }->{output_style}) eq 'COMPACT'; |
34
|
1
|
50
|
|
|
|
5
|
$options{output_style} = SASS_STYLE_EXPANDED if uc($self->{ _CONFIG }->{output_style}) eq 'EXPANDED'; |
35
|
1
|
50
|
|
|
|
6
|
$options{output_style} = SASS_STYLE_COMPRESSED if uc($self->{ _CONFIG }->{output_style}) eq 'COMPRESSED'; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
20
|
my $sass = CSS::Sass->new(%options); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
20
|
my ($css, $stats) = $sass->compile($text); |
42
|
1
|
|
|
|
|
1544
|
return $css; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |