MCPcopy Create free account
hub / github.com/11ty/dev-server / matchPassthroughAlias

Method matchPassthroughAlias

server.js:191–211  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

189 }
190
191 matchPassthroughAlias(url) {
192 let aliases = Object.assign({}, this.options.aliases, this.passthroughAliases);
193 for(let targetUrl in aliases) {
194 if(!targetUrl) {
195 continue;
196 }
197
198 let file = aliases[targetUrl];
199 if(url.startsWith(targetUrl)) {
200 let inputDirectoryPath = file + url.slice(targetUrl.length);
201
202 // e.g. addPassthroughCopy("img/") but <img src="/img/built/IdthKOzqFA-350.png">
203 // generated by the image plugin (written to the output folder)
204 // If they do not exist in the input directory, this will fallback to the output directory.
205 if(fs.existsSync(inputDirectoryPath)) {
206 return inputDirectoryPath;
207 }
208 }
209 }
210 return false;
211 }
212
213 isFileInDirectory(dir, file) {
214 let absoluteDir = TemplatePath.absolutePath(dir);

Callers 2

getOutputDirFilePathMethod · 0.95
testServer.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected