Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how we make allFiles.json #241

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ module.exports = function (eleventyConfig) {
return `${d.getMonth() + 1}/${d.getDate()}/${d.getFullYear()}`;
});

let fileList = [];

//Process wordpress posts
eleventyConfig.addCollection("wordpressposts", function (collection) {
const FolderNamePosts = "wordpress-posts";
Expand Down Expand Up @@ -167,19 +165,8 @@ module.exports = function (eleventyConfig) {
}
}

let newFile = {};
newFile.outputPath = item.outputPath;
newFile.inputPath = item.inputPath;
fileList.push(newFile);

});

// /blog/index.html is a generated page, remove it from the list
let abbrevFileList = fileList.filter(item => { return item.outputPath != "_site/blog/index.html";})

// store file list in build gen files directory
fs.writeFileSync('./_site_dist/allFiles.json',JSON.stringify(abbrevFileList),'utf8');

return output;
});

Expand Down Expand Up @@ -254,6 +241,19 @@ module.exports = function (eleventyConfig) {
}
});

eleventyConfig.on("eleventy.after", async ({ results }) => {
// Generate map of all HTML files for tests.
const files = results.map((r) => {
const { content, ...paths } = r;
return paths;
});

const htmlFiles = files.filter((p) => p?.outputPath?.endsWith(".html"));
const htmlFileJson = JSON.stringify(htmlFiles, null, 2);

fs.writeFileSync("./_site_dist/allFiles.json", htmlFileJson, "utf8");
});

return {
htmlTemplateEngine: "njk",
markdownTemplateEngine: "md",
Expand Down
Loading
Loading