Skip to content

Commit e02b21f

Browse files
committed
disable template caching in dev environment
1 parent d4290a6 commit e02b21f

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

README.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The backend defaults to C<api.metacpan.org>. Running a local API server is optio
1616

1717
Change METACPAN_API if you are running your own local API:
1818

19-
$ METACPAN_API=localhost:5000 twiggy lib/MetaCPAN/Web.pm -p 5001 -R lib -R templates -E development
19+
$ METACPAN_API=localhost:5000 twiggy lib/MetaCPAN/Web.pm -p 5001 -R lib -E development
2020

2121
This will use the API server at C<localhost:5000> and sets the port of the front-end to 5001.
2222
The process will watch changes in the current directory and start with the

bin/start_dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
2-
twiggy lib/MetaCPAN/Web.pm -p 5001 -R lib -R templates -E development
2+
twiggy lib/MetaCPAN/Web.pm -p 5001 -R lib -E development
33

lib/MetaCPAN/Web/View.pm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ Template::Alloy->define_vmethod(
6161
size => $size,
6262
default => Gravatar::URL::gravatar_url(
6363

64-
# Fallback to the CPAN address, as used by s.c.o, which will in
65-
# turn fallback to a generated image.
64+
# Fallback to the CPAN address, as used by s.c.o, which will in
65+
# turn fallback to a generated image.
6666
email => $author->{pauseid} . '@cpan.org',
6767
size => $size,
6868
default => $default,
@@ -80,10 +80,12 @@ sub new {
8080
COMPILE_DIR => 'var/tmp/templates',
8181
COMPILE_PERL => 1,
8282
STAT_TTL => 1,
83-
WRAPPER => [qw(wrapper.html)],
84-
ENCODING => 'utf8',
85-
AUTO_FILTER => 'html',
86-
PRE_PROCESS => ['preprocess.html'],
83+
CACHE_SIZE => $ENV{PLACK_ENV}
84+
&& $ENV{PLACK_ENV} eq 'development' ? 0 : undef,
85+
WRAPPER => [qw(wrapper.html)],
86+
ENCODING => 'utf8',
87+
AUTO_FILTER => 'html',
88+
PRE_PROCESS => ['preprocess.html'],
8789
);
8890
}
8991

0 commit comments

Comments
 (0)