]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::CSS; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use Gruntmaster::Page::Base; | |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | use File::Slurp qw/read_file/; | |
11 | use CSS::Minifier::XS qw/minify/; | |
12 | ||
13 | sub generate{ | |
14 | my ($self, $format, $logger, $theme) = @_; | |
15 | debug $logger => "theme is $theme"; | |
16 | return [404, ['Content-Type' => 'text/plain'], [ 'Not found' ]] unless -e "css/themes/$theme.css"; | |
17 | my $css = read_file "css/themes/$theme.css"; | |
18 | $css .= read_file $_ for <css/*.css>; | |
19 | [200, ['Content-Type' => 'text/css', 'Cache-Control' => 'public, max-age=604800'], [minify $css] ] | |
20 | } | |
21 | ||
22 | sub variants{ [[css => 1, 'text/css', undef, undef, undef, undef]] } | |
23 | ||
24 | 1 |