Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ranguard committed Jan 18, 2014
1 parent 470e8e4 commit b41acbc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Plack/Middleware/MCLess.pm
Expand Up @@ -30,7 +30,13 @@ sub new {

if( $ENV{PLACK_ENV} && $ENV{PLACK_ENV} eq 'development' ) {
# No caching, always build fresh
$self->cache_ttl('0'); # Auto change if running tests or something?

# Could have an extra ENV, say 'CSS_DEV' or something
# so default cache to 10 mins but 0 if CSS_DEV but that
# seems like more work for someone to help patch so for now
# take the processing hit - see once this is merged if
# this is a problem, even a few seconds would help
$self->cache_ttl('0');
$self->expires('0');
} else {
$self->cache_ttl('30 minutes') unless $self->cache_ttl;
Expand Down Expand Up @@ -70,6 +76,9 @@ sub serve {
sub _build_content {
my $self = shift;

# We can't use the mtime of the files to work out if we need
# to rebuild because a file can include other files!

my $content = join( "\n",
map { $self->_run_less($_) } @{ $self->files }
);
Expand Down

0 comments on commit b41acbc

Please sign in to comment.