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

Commit

Permalink
Merge pull request #106 from sortlist/synchronous-timestamp
Browse files Browse the repository at this point in the history
syncronous timestamp cache
  • Loading branch information
niftylettuce committed Jun 20, 2016
2 parents 1738f63 + 70a86c0 commit eec62c1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/main.js
Expand Up @@ -127,11 +127,12 @@ var renderTag = function(options, assets, attributes) {
name = name + '?cache=' + timestamp;
return createTag(src, "/" + name, attributes);
} else {
fs.exists(path.join(options.publicDir, assets), function(exists) {
if (exists) {
timestamp = fs.statSync(path.join(options.publicDir, assets)).mtime.getTime();
}
});
try {
var stats = fs.statSync(path.join(options.publicDir, assets));
timestamp = stats.mtime.getTime();
} catch (err) {
throwError('file not found');
}
position = assets.lastIndexOf('.');
//var name = _(assets).splice(position, 0, '.' + timestamp)
var name = assets + '?cache=' + timestamp;
Expand Down

0 comments on commit eec62c1

Please sign in to comment.