Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Invalidates built-in dust cache if caching disabled #76

Merged
merged 1 commit into from

4 participants

@fatjonny

My problem: Dust checks it's internal cache before calling dust.onLoad which has the effect that any template included within another template gets automatically cached and setting options.cache has no effect on the internal dust cache.

For example, if you have:

index.dust

{>"layout"/}

{<body}
  my index body
{/body}

and layout.dust

<html>
  <head>
    <title>example</title>
  </head>
  <body>
    {+body/}
  </body>
</html>

If you view index, then add something to layout.dust after having viewed index once, you will have to restart the server to see your change to layout reflected.

Ideally I would be able to modify the dust.register function, but I don't see how to do that since dust always tries to read from dust.cache.

This was the best solution I could come up with, any other suggestions?

@tj
Owner
tj commented

hmm sounds ok i guess if it works! needs a rebase against master

@razic

I've tested this and it works. Please merge so we can delete our fork :+1:

@ForbesLindesay

It may still need a rebase

@razic

@ForbesLindesay are you going to do the rebase so we can get it merged in?

PS thanks for solving this issue.

@fatjonny

I think I messed up the rebase although I am not entirely sure how, but now more than just my one line is changed. I can just fork the repo again and re-do that pull request to make it be correct.

@razic

@fatjonny you don't need to redo the pullrequest, just force push to this branch

@fatjonny

Thanks @razic, that made sense. The commit now looks up to date and correct to me.

@razic

+:100:

@tj tj merged commit 44260da into from
@razic

@visionmedia thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2013
  1. @fatjonny
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/consolidate.js
View
1  lib/consolidate.js
@@ -212,6 +212,7 @@ exports.dust.render = function(str, options, fn){
if (options.views) views = options.views;
if (options.settings && options.settings.views) views = options.settings.views;
}
+ if (!options || (options && !options.cache)) engine.cache = {};
engine.onLoad = function(path, callback){
if ('' == extname(path)) path += '.' + ext;
Something went wrong with that request. Please try again.