summaryrefslogtreecommitdiff
path: root/rt/html/NoAuth/css/dhandler
diff options
context:
space:
mode:
Diffstat (limited to 'rt/html/NoAuth/css/dhandler')
-rw-r--r--rt/html/NoAuth/css/dhandler30
1 files changed, 30 insertions, 0 deletions
diff --git a/rt/html/NoAuth/css/dhandler b/rt/html/NoAuth/css/dhandler
new file mode 100644
index 0000000..4c8ba34
--- /dev/null
+++ b/rt/html/NoAuth/css/dhandler
@@ -0,0 +1,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>