So today's Eleventy 1.0 feature is pretty minor, but since I asked for it, it's the most important feature ever! (Ok, no, not really, but I still like it.) Eleventy 1.0 nows supports the ability to dynamically ignore files. What does that mean?

Eleventy can be told to ignore files by using a file named .eleventyignore. This matches the same format as .gitignore. I use this feature on my blog as a way to make local development much quicker. Here's how mine looks:


Basically, when working locally I have Eleventy ignore 90% of my previous blog posts. This makes builds go much quicker when I'm writing blog posts or testing other things locally. Note, as the docs state, you do not have to include things already in your .gitignore so the /node_modules there could be removed.

Because of how I'm using the ignores feature, I'm sure to not include it in my repository as it would nuke most of my content in production. That means everytime I tweak it one place (like my desktop), I have to tweak it in another (like my laptop, and honestly, only if I really care to).

In Eleventy 1.0, you can now both add, and remove, from the ignored files setting via configuration settings. So for example:


You could remove too, via delete:


All of which means that if you have a case like mine where the ignore files are different based on environment, you could check process.env.NODE_ENV (or some other value) and dynamically ignore based on one environment versus another.

Even better, this is additive. While for me I had no ignores in production, if you had stuff you wanted to ignore everywhere and optionally ignore more in one environment, you can still use .eleventyignore for the global items and the API for the dynamic one.

So again, simple feature, but I'm psyched to see it in Eleventy 1.0!