1package App::Netdisco::Web::Static; 2 3use Dancer ':syntax'; 4use Path::Class; 5 6get '/plugin/*/*.js' => sub { 7 my ($plugin) = splat; 8 9 my $content = template 10 'plugin.tt', { target => "plugin/$plugin/$plugin.js" }, 11 { layout => undef }; 12 13 send_file \$content, 14 content_type => 'application/javascript', 15 filename => "$plugin.js"; 16}; 17 18get '/plugin/*/*.css' => sub { 19 my ($plugin) = splat; 20 21 my $content = template 22 'plugin.tt', { target => "plugin/$plugin/$plugin.css" }, 23 { layout => undef }; 24 25 send_file \$content, 26 content_type => 'text/css', 27 filename => "$plugin.css"; 28}; 29 30true; 31