Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Fix it for there is no file in the local file system #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/cachebust.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down