Skip to content

Commit

Permalink
Fix bug with for-free passthrough copy: 11ty/eleventy#2456
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jun 24, 2022
1 parent b1891f7 commit 49c8bdf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ class EleventyDevServer {

let file = this.passthroughAliases[targetUrl];
if(url.startsWith(targetUrl)) {
return file + url.slice(targetUrl.length);
let inputDirectoryPath = file + url.slice(targetUrl.length);

// e.g. addPassthroughCopy("img/") but <img src="/img/built/IdthKOzqFA-350.png">
// generated by the image plugin (written to the output folder)
// If they do not exist in the input directory, this will fallback to the output directory.
if(fs.existsSync(inputDirectoryPath)) {
return inputDirectoryPath;
}
}
}
return false;
Expand Down

0 comments on commit 49c8bdf

Please sign in to comment.