Skip to content

Commit

Permalink
show how to add paths and classes with higher precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 6, 2015
1 parent cca80a6 commit 424c7a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Mojolicious.pm
Expand Up @@ -437,6 +437,9 @@ L<Mojolicious::Guides::Rendering>.
# Add another "templates" directory
push @{$app->renderer->paths}, '/home/sri/templates';
# Add another "templates" directory with higher precedence
unshift @{$app->renderer->paths}, '/home/sri/theme/blue/templates';
# Add another class with templates in DATA section
push @{$app->renderer->classes}, 'Mojolicious::Plugin::Fun';
Expand Down Expand Up @@ -497,6 +500,9 @@ L<Mojolicious::Static> object.
# Add another "public" directory
push @{$app->static->paths}, '/home/sri/public';
# Add another "public" directory with higher precedence
unshift @{$app->static->paths}, '/home/sri/theme/blue/public';
# Add another class with static files in DATA section
push @{$app->static->classes}, 'Mojolicious::Plugin::Fun';
Expand Down
6 changes: 6 additions & 0 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -296,6 +296,9 @@ for templates to be detected.
# Add another class with templates in DATA section
push @{$renderer->classes}, 'Mojolicious::Plugin::Fun';
# Add another class with templates in DATA section and higher precedence
unshift @{$renderer->classes}, 'Mojolicious::Plugin::MoreFun';
=head2 default_format
my $default = $renderer->default_format;
Expand Down Expand Up @@ -346,6 +349,9 @@ Directories to look for templates in, first one has the highest precedence.
# Add another "templates" directory
push @{$renderer->paths}, '/home/sri/templates';
# Add another "templates" directory with higher precedence
unshift @{$renderer->paths}, '/home/sri/theme/blue/templates';
=head1 METHODS
L<Mojolicious::Renderer> inherits all methods from L<Mojo::Base> and implements
Expand Down
6 changes: 6 additions & 0 deletions lib/Mojolicious/Static.pm
Expand Up @@ -184,6 +184,9 @@ to be detected.
# Add another class with static files in DATA section
push @{$static->classes}, 'Mojolicious::Plugin::Fun';
# Add another class with static files in DATA section and higher precedence
unshift @{$static->classes}, 'Mojolicious::Plugin::MoreFun';
=head2 paths
my $paths = $static->paths;
Expand All @@ -194,6 +197,9 @@ Directories to serve static files from, first one has the highest precedence.
# Add another "public" directory
push @{$static->paths}, '/home/sri/public';
# Add another "public" directory with higher precedence
unshift @{$static->paths}, '/home/sri/theme/blue/public';
=head1 METHODS
L<Mojolicious::Static> inherits all methods from L<Mojo::Base> and implements
Expand Down

0 comments on commit 424c7a2

Please sign in to comment.