Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
Keep track of dependent files
Browse files Browse the repository at this point in the history
  • Loading branch information
gregives committed Nov 8, 2020
1 parent 0f19969 commit fae7fda
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ class EleventyLoad {

// Process additional dependencies straight away
async addDependency(path) {
return await this.processFile(null, path);
// Keep track of dependent resource
const resource = this.context.resource;
this.context.resource = path;

// Return the result of processed file
const result = await this.processFile(null, path);

this.context.resource = resource;
return result;
}

// Get loaders for path
Expand Down Expand Up @@ -56,9 +64,6 @@ class EleventyLoad {
content = await this.getContent(path, loaders);
}

// Add resource to context
this.context.resource = path;

// Apply loaders to content in order
for (const loader of loaders) {
const loaderFunction = loader.loader.bind(this.context);
Expand Down

0 comments on commit fae7fda

Please sign in to comment.