From 25200193502ffb90ae68c6a6cfff2df6d943665d Mon Sep 17 00:00:00 2001 From: juscelior Date: Fri, 10 Mar 2017 17:55:26 -0300 Subject: [PATCH] Fix it for there is no file in the local file system and you want to use MD5 hash --- lib/cachebust.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cachebust.js b/lib/cachebust.js index b818ec7..2e2b175 100644 --- a/lib/cachebust.js +++ b/lib/cachebust.js @@ -60,7 +60,8 @@ exports.busted = function(fileContents, options) { var originalAttrValue = loadAttribute(elements[i]); // Test for http(s) and // and don't cache bust if (assumed) served from CDN - if (!protocolRegEx.test(originalAttrValue)) { + // Test for file exist in local filesytem + if (!protocolRegEx.test(originalAttrValue) && fs.existsSync(options.basePath + originalAttrValue.split("?")[0])) { fileContents = self[options.type](fileContents, originalAttrValue, options); } }