Include content from metalsmith database #1
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
andyburke/metalsmith-simple-includes#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Check if the content exists in the metalsmith content database before reading from the filesystem.
Can you elaborate? How would this look in practice?
The pattern is inspired by simple c-style includes, where the expectation is that the file lives on the filesystem somewhere. How would it live in the "metalsmith content database"?
At this point:
https://github.com/andyburke/metalsmith-simple-includes/blob/master/index.js#L29-L31
Rather than retrieving the path to the Metalsmith directory and reading the file from the filesystem, we could....
files[path]beforehand to see if the file exists in the metalsmith databasecontentsinsteadfiles[path]doesn't exist, fallback to usingfs.readFilePathThis way, you could stick plugins on the file before simple-includes, and those plugin changes would be present in the included content.