]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/CSS.pm
Pass PSGI env to generators
[gruntmaster-page.git] / lib / Gruntmaster / Page / CSS.pm
CommitLineData
7dc32473
MG
1package Gruntmaster::Page::CSS;
2
3use 5.014000;
4use strict;
5use warnings;
6use Gruntmaster::Page::Base;
7our @ISA = qw/Gruntmaster::Page::Base/;
8our $VERSION = '0.001';
9
10use File::Slurp qw/read_file/;
11use CSS::Minifier::XS qw/minify/;
12
13sub generate{
191f4979
MG
14 my ($self, $format, $env, $theme) = @_;
15 debug $env => "theme is $theme";
5a2112d3 16 return [404, ['Content-Type' => 'text/plain'], [ 'Not found' ]] unless -e "css/themes/$theme.css";
7dc32473
MG
17 my $css = read_file "css/themes/$theme.css";
18 $css .= read_file $_ for <css/*.css>;
eac599be 19 [200, ['Content-Type' => 'text/css', 'Cache-Control' => 'public, max-age=604800'], [minify $css] ]
7dc32473
MG
20}
21
22sub variants{ [[css => 1, 'text/css', undef, undef, undef, undef]] }
23
241
This page took 0.027145 seconds and 4 git commands to generate.