Mojolicious::Plugin::Alias - serve static files from aliased paths
# Mojolicious $self->plugin('alias', { '/images' => '/foo/bar/dir/images', '/css' => '/here/docs/html/css' } ); # Mojolicious::Lite plugin alias => { '/people/fry/photos' => '/data/foo/frang' }; # statics embedded in __DATA__ plugin alias => { '/people' => {classes => ['main']} }; # multiple paths also possible plugin alias => { '/people/leela/photos' => { paths => [ '/data/foo/zoop', '/data/bar/public' ] } };
Mojolicious::Plugin::Alias lets you map specific routes to collections of static files. While by default a Mojolicious app will serve static files located in any directory in the app-static->paths> array, Mojolicious::Plugin::Alias will set up a seperate Mojolicious::Static object to serve files according to the specified prefix in the URL path.
app-
When developing with the stand-alone webserver, this module allows you to mimic server paths that might be used in your templates.
When installing the plugin, pass a reference to a hash of aliases (server paths). The keys of the hash are URL path prefixes and must start with a '/' ( leading slash). The values of the hash can be either directory paths (a single string) or hash references that will initialize Mojolicious::Static objects - they must have either paths or classes keys, with array reference values.
paths
classes
Dotan Dimet, dotan@corky.net.
dotan@corky.net
Copyright (C) 2010,2014, Dotan Dimet.
Artistic 2.0
==head1 SEE ALSO
Mojolicious, Mojolicious::Guides, http://mojolicious.org.
To install Mojolicious::Plugin::Alias, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Alias
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Alias
For more information on module installation, please visit the detailed CPAN module installation guide.