Permalink
Browse files

make refresh works on real template file changes

  • Loading branch information...
1 parent f22529d commit d15192619713b044878301c6f911df4c27aa0d84 @fayland committed Apr 11, 2013
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/Mojolicious/Plugin/TtRenderer/Engine.pm
@@ -177,7 +177,7 @@ sub options { @_ > 1 ? $_[0]->{options} = $_[1] : $_[0]->{options} }
sub _template_modified {
my($self, $template) = @_;
- return 1 if $self->SUPER::_template_modified($template);
+ return $self->SUPER::_template_modified($template) if -r $template;
return $template =~ /^templates(?:\/|\\)/;
}
@@ -186,11 +186,11 @@ sub _template_content {
my ($path) = @_;
my $options = delete $self->{options};
-
+
# Convert backslashes to forward slashes to make inline templates work on Windows
$path =~ s/\\/\//g;
my ($t) = ($path =~ m{templates\/(.*)$});
-
+
if (-r $path) {
return $self->SUPER::_template_content(@_);
}
@@ -232,13 +232,13 @@ Add the handler:
sub startup {
...
-
+
# Via mojolicious plugin
$self->plugin(tt_renderer => {template_options => {FILTERS => [ ... ]}});
-
+
# Or manually
use Mojolicious::Plugin::TtRenderer::Engine;
-
+
my $tt = Mojolicious::Plugin::TtRenderer::Engine->build(
mojo => $self,
template_options => {
@@ -306,9 +306,9 @@ templates. Will default to a temp-dir if not set.
=head1 SEE ALSO
-L<Mojolicious::Plugin::TtRenderer::Engine>,
-L<Mojolicious>,
-L<Mojolicious::Guides>,
+L<Mojolicious::Plugin::TtRenderer::Engine>,
+L<Mojolicious>,
+L<Mojolicious::Guides>,
L<http://mojolicious.org>.
=head1 AUTHOR

0 comments on commit d151926

Please sign in to comment.