Be much more specific about ignoring specific vendored directories. #5564

Merged
merged 2 commits into from Nov 10, 2016

Projects

None yet

6 participants

@parkr
Member
parkr commented Nov 9, 2016 edited

An alternative to github/pages-gem#352, but it probably won't work.

The way exclusion works in Jekyll is really pretty naïve. In EntryFilter#filter, it iterates through an array of pathnames and checks to see if each pathname is included, excluded, etc. The way reading works in Jekyll, this list of pathnames is just the basename, so vendor/cache becomes first vendor, then (if not excluded), we get the array of files and directories inside of vendor as basenames, e.g. cache instead of vendor/cache.

I'd love to rethink the way we do reading so we get the full pathname from the site source, or allow EntryFilter's base_directory path to be included in exclusion testing.

I checked and the code for exclusion already does this! 🎉

def excluded?(entry)
  glob_include?(site.exclude, relative_to_source(entry))
end
lib/jekyll/configuration.rb
@@ -17,7 +17,7 @@ class Configuration < Hash
# Handling Reading
"safe" => false,
"include" => [".htaccess"],
- "exclude" => %w(node_modules vendor),
+ "exclude" => %w(node_modules vendor/bundle vendor/ruby vendor/cache),
@ashmaroli
ashmaroli Nov 9, 2016 edited Contributor

is there a way to use wildcards to exclude any future sub-directory under /vendor/?

@parkr
parkr Nov 9, 2016 edited Member

@ashmaroli You'd just exclude vendor/. In this case, excluding all of vendor/ has caused a lot of problems so we're reverting it.

@ashmaroli
ashmaroli Nov 9, 2016 Contributor

nevermind.. i jus saw the PR body of the linked pull and your explanation...

@pnn pnn was assigned by jekyllbot Nov 9, 2016
@parkr parkr added the friction label Nov 9, 2016
parkr added some commits Nov 9, 2016
@parkr parkr Be much more specific about ignoring vendored directories. b194211
@parkr parkr Add vendor/gems to the list of excluded & do some refactoring.
7bf4627
@crispgm
Member
crispgm commented Nov 10, 2016

What about making the exclusion more explicitly?

@parkr
Member
parkr commented Nov 10, 2016

What about making the exclusion more explicitly?

@crispgm What do you mean? We are making the exclusion more explicit here. By adding the /, then we are saying "ignore these directories." We don't want to exclude all of vendor/.

@parkr parkr changed the title from Be much more specific about ignoring vendored directories. to Be much more specific about ignoring specific vendored directories. Nov 10, 2016
@parkr
Member
parkr commented Nov 10, 2016

@jekyllbot: merge +bug

@jekyllbot jekyllbot merged commit c7b3017 into master Nov 10, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jekyllbot jekyllbot added bug fix labels Nov 10, 2016
@jekyllbot jekyllbot deleted the vendor-bundle branch Nov 10, 2016
@ashmaroli ashmaroli referenced this pull request Nov 15, 2016
Merged

Exclude vendor by default #5361

1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment