summaryrefslogtreecommitdiff
path: root/rt/html/NoAuth/css/dhandler
blob: 4c8ba340592e7d13a6fc822573ac1c4a984a955f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<%ONCE>
my $squisher;
</%ONCE>
<%INIT>
my $arg = $m->dhandler_arg;
my $path;
if ( $arg =~ m{^(.*)-squished(\.[^\.]+)$} ) {
    $path = $m->current_comp->dir_path .'/'. $1 . $2;
}
else {
    return $m->decline;
}

$squisher = new RT::CSS::Squish unless $squisher;
$squisher->{'mason'} = $m;

$m->out( $squisher->concatenate( $path ) );

package RT::CSS::Squish;
use CSS::Squish '0.06';
use base qw(CSS::Squish);
sub file_handle {
    my $self = shift;
    my $file = shift;
    my $content = $self->{'mason'}->scomp($file);
    open my $fh, '<', \$content or die "$!";
    return $fh;
}

</%INIT>