Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Handling conflicts between include and exclude configuration #2054

jbranchaud opened this Issue · 5 comments

3 participants


A question: How does Jekyll handle a scenario where there is a conflict between what is specified as an include and an exclude in the _config.yml?

Consider the following:

exclude: ['']
include: ['']

Sure, this is silly, the developer should probably be responsible for this not happening. Nevertheless, does Jekyll have a strategy for this. Does it default to the first, to the last, to includes/excludes?

Though, what about a more realistic scenario. I want to ignore the root-level css directory, but I would like assets/css to be included:

exclude: ['css']
include: ['assets/css']

As of Jekyll 1.4.3, this situation doesn't play out well. The exclusion of css clobbers all directories named css in my Jekyll project regardless of location and regardless of the include configuration. It seems like this particular scenario might be mitigated with excludes (and includes?) processed relative to the site source in 2.0.0.

Or what about excluding all images (jpg) except those in the img directory:

exclude: ['*.jpg']
include: ['img/*.jpg']
exclude: ['css']
include: ['assets/css']

For what it's worth, this isn't supported at all anyway as I found out earlier tonight. Jekyll doesn't currently allow subdirectory filtering like this in these parameters. Annoys me no end too. Try simply excluding assets/css, it won't get excluded.


@mscharley If you

Jekyll doesn't currently allow subdirectory filtering like this in these parameters.

I would be honored to accept a pull request for a fix! 2.0 can contain breaking changes so as long as it's well-documented, it is :+1: to go.


@mscharley I think subdirectory filtering will be supported in 2.0. At least it seemed to be when I was playing around with the pre-release.

Regardless, I am still curious about the stance that Jekyll takes on this subject. @parkr: Is there a stated/documented policy on how Jekyll is expected to react when there are conflicts between what is in the include and exclude arrays? Because for now, Jekyll doesn't filter in the ways I have come to expect in many tools (e.g. Grunt). I am not trying to say Jekyll needs to conform to a particular behavior, but rather suggesting that filtering behavior be well-documented and explained so everyone knows what to expect.

I'd be glad to help write documentation or improve the filtering code, but I first need to know what is intended by the core team.


I take it back, it is definitely working in 2.0 currently which is strange because I could swear it wasn't when I did my initial round of testing.

@jbranchaud See last reply about import vs. export. How do you expect it to work? In my experience these sorts of filters are usually implemented how Jekyll does, ie. include > all but I've not used Grunt before.

@parkr parkr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.