Tuesday, July 28, 2009

Serving static files with Catalyst

Serving static javascript files from Catalyst can be a hassle. URLs don't match etc.

If instead you change your MyApp.pm file as follows

__PACKAGE__->config->{static}->{dirs} = [
'static',
qr/^(images|css|js)/,
];

and you place your javascript files in the MyApp/root/js directory, the hassle's gone.

Even better, if you don't have application specific files, you can symlink the directory to the one where you keep the same files to be served by Lighttpd.

No comments: