Description
Trying to identify if in .eleventy.js
if there is a way to determine if I want to process a file or not.
I would love it if I can do the following for example -
Frontmatter
---
status: draft
---
# Test
.eleventy.js
module.exports = function(eleventyConfig) {
eleventyConfig.ignoreFiles(function(file) {
return (process.env.DRAFT === 'true') ? false : file.data.status === 'draft';
});
};
NPM Scripts
"scripts": {
"build": "DRAFT='true' eleventy --input=src --output=dist",
"dev": "DRAFT='true' eleventy --input=src --output=dist --serve",
"publish": "eleventy --input=src --output=dist"
}
This would allow the ability to not only setup draft or other conditions for publications, but even future date publications (check timestamp), ignore files to specific output targets - Example - api docs & frontend component docs could share a repo, but have two different build targets? Maybe they end up on different domains.
I tried looking through the code to see if I could add support for this, but I am a little unclear what determine what should render outside of the ignoreFiles which takes a full file path. So you would need to scan all files in a prestep to add it too that list running the function passed into the config.