Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

BUG: timestamp cache not set properly #94

Open
johanlaidlaw opened this issue Dec 2, 2015 · 0 comments
Open

BUG: timestamp cache not set properly #94

johanlaidlaw opened this issue Dec 2, 2015 · 0 comments

Comments

@johanlaidlaw
Copy link
Contributor

In function renderTag() the cache timestamp is determined, but only set if the file exists. As you can see, this will never work.

fs.exists(path.join(options.publicDir, assets), function(exists) {
  if (exists) {
    timestamp = fs.statSync(path.join(options.publicDir, assets)).mtime.getTime();
  }
});
position = assets.lastIndexOf('.');
var name = assets + '?cache=' + timestamp;
return createTag(src, name, attributes);

The situation is that you start the server and an asset you have specified in the html/css does not exist on the filesystem. What should happen in this case? Should the html tag still be rendered and in that case what should the ?cache parameter be set to?

If you get rid of the fs.exists check it will throw an exception at server start which might be a better way of handling the error?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant