-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrity checking and dependency resolution now
account for templates having indirect references to includes - addresses issue #82
- Loading branch information
1 parent
c45de85
commit e97feec
Showing
5 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { parse } = require("path"); | ||
const getCachedMatter = require("./getCachedMatter"); | ||
|
||
module.exports = (templatePath, dataKey, pathsToFragments) => { | ||
// find the fragment associated with the template | ||
const fragmentPath = pathsToFragments.find(fragmentPath => | ||
getCachedMatter(fragmentPath).data.template === parse(templatePath).base); | ||
// if found then return the property value for dataKey - will | ||
// return undefined if fragment wasn't found (not implemented yet) or | ||
// if found fragment's matter.data doesn't have a key by that name | ||
if (fragmentPath) { | ||
const fragmentMatter = getCachedMatter(fragmentPath); | ||
return fragmentMatter.data[dataKey]; | ||
} | ||
}; |