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

BUG: timestamp cache not set properly #94

@johanlaidlaw

Description

@johanlaidlaw

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions