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

Already on GitHub? Sign in to your account

Excluding subdirectory from being generated #906

Closed
Apathetic012 opened this Issue Mar 31, 2013 · 41 comments

Comments

Projects
None yet

I wanted to exclude assets/sass from being included into the generated _site:

exclude:
  - assets/sass
  - README.md
  - config.rb

However it still includes assets/sass. I tried adding a trailing slash, putting it inside quotation marks but none works?

Directioner forever

Use sass instead of assets/sass. :)

jwebcat commented Mar 31, 2013

@Apathetic012 you can also put the directories / files you want to exclude in an array like
[sass, readme.md, config.rb]

aahan commented Mar 31, 2013

@Apathetic012 Add this in your config.yml file and see if it does it:

exclude: [assets/sass/]

More info on Jekyll Configuration Settings Wiki

Alternatively, if possible, just add an _ (underscore) to the name of the directories you want to exclude. So, in your case, rename sass to _sass.

jwebcat commented Mar 31, 2013

@aahan I tried that as well. No dice
In the docs it says that adding a trading slash will work with sub dirs
I think we should start an issue.

Contributor

stomar commented Mar 31, 2013

I had the same problem just a couple of hours ago.

Adding an underscore is no option (e.g. for Gemfile, Capfile, ...)

IMO there are at least two problems with exclude:

  1. The behaviour is not documented correctly (or not implemented as intended...):
$ ls -R
.:
_config.yml  dir1  dir2  dir3  dir4  index.md

./dir1:
index1.md  index2.md

./dir2:
index.md

./dir3:
index.md

./dir4:
index.md
$ cat _config.yml             
safe:        false
auto:        true
server:      true
server_port: 4000
pygments:    true

exclude:
  - dir1/index2.md
  - dir2/
  - dir3
$ jekyll --no-auto --no-server
[...]
$ ls -R _site
_site:
dir1  dir2  dir4  index.html

_site/dir1:
index1.html  index2.html

_site/dir2:
index.html

_site/dir4:
index.html
  1. It should be possible to specify a full path and exclude only a specific file in a specific directory (exclude: README.md will exclude all README.md files in the complete directory tree).

aahan commented Mar 31, 2013

@jwebcat Well, we already did, didn't we? And I agree with you. I am starting to see a couple of things, not working as described in Jekyll docs (for example).

jwebcat commented Mar 31, 2013

@aahan agreed :) as we would obviously like to have the same name for multiple different locations as with

what-a-page
--index.md
another-page
--index.md

as @stomar points out this kind of seems like a no-brainer that it should be an option.

Or at the very least we could know how it is done, although I have tried every possibility I could think of with no dice.

Contributor

stomar commented Mar 31, 2013

I believe the current "options" are:

  • exclude the complete directory (and all other files/directories with the same basename, too)
  • exclude the specific file (and all other files/directories with the same basename, too)

🙀

I guess my last resort for now is to prepend an underscore to the directory.

jwebcat commented Mar 31, 2013

@parkr any chance this is coming with the next release?

@Apathetic012, do you use stable or beta? I use the same structure as you, ie: assets/sass, and I can exclude the folder by having exclude: ["sass"] in my config file.

@gummesson my version's Jekyll 0.12.1.


EDIT: I updated to jekyll 1.0.0.beta2 and I do can ignore the folder through it's name. I guess I should close this?

Contributor

stomar commented Mar 31, 2013

@Apathetic012, as long as you do not have another file/directory sass in the directory tree, exclude: sass should work fine.

Contributor

stomar commented Mar 31, 2013

I think the issue should be kept open.

@Apathetic012 Apathetic012 reopened this Mar 31, 2013

jwebcat commented Mar 31, 2013

@stomar I agree this seems like a no brainer.

It's almost pointless to attempt a PR as almost all new features are bring shot down by the elders in charge of Jekyll with the excuse that it will make Jekyll too complex.

... it seems like we're in a kind of waiting zone until new features are ok'ed by @mojombo . I know there are a lot of things to take into account with each new feature request.

Other wise I guess we can make a fork that will be more conformist to obvious public needs and features requests, instead of some kind of personal blog project that github happens to be using for hmm pages, and everyone is using and contributing to.

incremental regeneration for example is one thing I flat out need if I see myself using Jekyll much longer.

Anyone... thoughts?

Owner

mattr- commented Apr 1, 2013

I can confirm the following:

  • Using assets/sass as a part of exclude does not work
  • Using assets/sass/ as a part of exclude does not work
  • Using sass/ as part of exclude does not work
  • Using sass as a part of exclude does work
  • Having README.md in exclude means that any file with the name README.md anywhere within the site's files and subdirectories will be excluded from the generated site.
  • The current functionality seems to be in place since at least v0.10 (that's as far back as I went), which is two years. I suspect it's been this way even longer.

We intend to update the documentation before 1.0.0 is released. If you'd like to accelerate the release and reduce your frustration, I highly suggest helping out to make the docs match what is implemented. The help would be gladly welcome. You may also submit a pull request for the particular behavior you want and we can discuss what the desired functionality should be. In the meantime, I've adjusted the wiki page to remove the comment about the trailing slash, since it doesn't apply

jwebcat commented Apr 1, 2013

@mattr- wonderful 👍 I am more than willing to help update the docs.

  • let's all make Jekyll rock!
Contributor

stomar commented Apr 1, 2013

I'm just guessing but the behavior of include is probably similar and would have to be considered also for future feature or pull requests.

The documentation is not clear about the precedence of exclude and include.

Owner

parkr commented Apr 1, 2013

1.0 betas support glob exclusion. assets/sass/**/* should work.

@parkr parkr closed this Apr 1, 2013

jwebcat commented Apr 1, 2013

@parkr include behaves the same then I imagine right?

Owner

parkr commented Apr 1, 2013

I believe so.

jwebcat commented Apr 1, 2013

@parkr cool. I will test it.

I Would love your opinion on this rakefile I made for Jekyll https://github.com/jwebcat/rake-jekyll-grunt.git it uses grunt and live reload. My ruby is super basic and I imagine could be improved.

Any thoughts on how I should exclude only a root directory or file.
From the source Jekyll directory I want to ignore ./vendor

exclude:
  - vendor

Ignores all vendor folders anywhere
Other options I've tried

- /vendor
- /vendor/
- ./vendor/

Thoughts?

jwebcat commented Sep 14, 2013

Did you try vendor/* ?
On Sep 13, 2013 5:03 PM, "Zach" notifications@github.com wrote:

Any thoughts on how I should exclude only a root directory or file.
From the source Jekyll directory I want to ignore ./vendor

exclude:

  • vendor

Ignores all vendor folders anywhere
Other options I've tried

  • /vendor
  • /vendor/
  • ./vendor/

Thoughts?


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/issues/906#issuecomment-24432321
.

Just tried, no dice.

jwebcat commented Sep 14, 2013

You could always do _dir
With underscore. I think by default doesn't Jekyll ignore dirs starting
with underscore?
On Sep 13, 2013 5:15 PM, "Zach" notifications@github.com wrote:

Just tried, no dice.


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/issues/906#issuecomment-24432675
.

Yeah that solves my problem, but I thought I would bring up that this type of matching doesn't work. I would have expected it to work much like gitignore. For now I'll use underscores.

jwebcat commented Sep 14, 2013

I guess it's supposed to be used for glob ignores like

assets/*/.js
On Sep 13, 2013 5:19 PM, "Zach" notifications@github.com wrote:

Yeah that solves my problem, but I thought I would bring up that this type
of matching doesn't work. I would have expected it to work much like
gitignore. For now I'll use underscores.


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/issues/906#issuecomment-24432773
.

Contributor

stomar commented Sep 16, 2013

As I already stated 6 months ago, I still think there should be a way to exclude /vendor but not /some_dir/vendor.

jwebcat commented Sep 16, 2013

Agreed
On Sep 15, 2013 10:04 PM, "Marcus Stollsteimer" notifications@github.com
wrote:

As I already stated 6 months ago, I still think there should be a way to
exclude /vendor but not /some_dir/vendor.


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/issues/906#issuecomment-24489090
.

@afeld afeld referenced this issue in github/choosealicense.com Dec 12, 2013

@afeld afeld ignore test directories from build 804fc48
Contributor

robwierzbowski commented Dec 28, 2013

Glob ignores don't seem to work in 1.3.1. With the directory assets/js,

assets/js doesn't exclude
assets/js/**/* doesn't exclude
js excludes, but of course excludes all other js directories too.

Any other workarounds / fixes for nested excluded directories?

jwebcat commented Dec 28, 2013

Use an underscore
On Dec 28, 2013 2:48 PM, "Rob Wierzbowski" notifications@github.com wrote:

Glob ignores don't seem to work in 1.3.1. With the directory assets/js,

assets/js doesn't exclude
assets/js/*/ doesn't exclude
js excludes, but of course excludes all other js directories too.

Any other workarounds / fixes for nested excluded directories?


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/issues/906#issuecomment-31306613
.

jwebcat commented Dec 28, 2013

In the name of the directory like _js

Jekyll will ignore all directories prepended with underscore.
On Dec 28, 2013 2:49 PM, "Jupiter St. John" jwebcat@gmail.com wrote:

Use an underscore
On Dec 28, 2013 2:48 PM, "Rob Wierzbowski" notifications@github.com
wrote:

Glob ignores don't seem to work in 1.3.1. With the directory assets/js,

assets/js doesn't exclude
assets/js/*/ doesn't exclude
js excludes, but of course excludes all other js directories too.

Any other workarounds / fixes for nested excluded directories?


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/issues/906#issuecomment-31306613
.

Contributor

maban commented Jan 2, 2014

In case this helps anyone else, I was having trouble getting Jekyll to exclude Grunt generated files and directories without an underscore. I thought there was something wrong with my syntax, but when I restarted Terminal after editing the config file, it finally worked. Here's what my exclude looks like:

exclude: [node_modules, package.json, npm-debug.log, Gruntfile.js, scss]

evert commented Apr 15, 2014

bit surprised that this is still an issue after a year.

Contributor

mscharley commented Apr 15, 2014

It's fixed in 2.0

On 16 April 2014 03:39, Evert Pot notifications@github.com wrote:

bit surprised that this is still an issue after a year.


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/issues/906#issuecomment-40511117
.

evert commented Apr 15, 2014

Thank you, that's good to know!

Contributor

ryanburnette commented May 3, 2014

I format my excludes this way. Doesn't matter as long as it's yaml. The behavior is the same. I use a few keywords to ignore directories because Jekyll doesn't support glob in excludes. It'll be cool when 2.x comes out and adds that though.

# _config.yml
exclude:
  - 'src'
  - 'source'
  - 'sass'

Hello. I am from the future, specifically February 2015. This issue is still not resolved. It is possible to exclude a folder by putting its exact name in the exclude. If the folder's name is, say, xyzzy, you can put
xyzzy, or xyzzy/ and the folder will be excluded.

If you say xyzzy/foo.bar, it appears that you cannot exclude just foo.bar.

If you say xyzzy, not xyzzy/, the folder will be excluded and so will any file (and folder?) containing the string 'xyzzy', such as article-about-xyzzy-magic-word.md

File watch does not interpret the things in exclude the same way that jekyll generation does. It is possible to set things up so that watch will not trigger but jekyll will generate the file if started manually. I believe it is possible to do the reverse.

There are essentially zero working examples anywhere. I would wager that there are no working tests or checks as well, since if there were someone would surely have published them by now.

This is not the end of the world. I'll write to you about that later. But it is not particularly good nor impressive.

+1 to what @RonJeffries said... this issue seems to have re-appeared.

I have been using the following include configuration for the past 6 months to ensure that the entire contents of my sass directory are copied for purposes of source mapping... It was working until a few days ago.

include:
  - "sass/_*"

The only way I can get the underscored files / directories in my sass directory to be copied during build - is by changing my include to:

include:
  - "_*"

This is sub-optimal, however, because it now copies the entirety of _includes, _layouts, _data, etc.

@parkr @mojombo should a new issue be opened - or is this issue still an appropriate place to investigate possible regressions?

Using jekyll 2.4.0

Thanks for your time.

Contributor

nhoizey commented Aug 28, 2015

I am strugling with this as well, with Jekyll 2.5.3.

I have a tags folder in the root, and I want its content to be added to the _site/tags/ folder that is generated by the jekyll tagging plugin.

I tried several syntaxes, from the comments in this thread, with no result.

@ThomDietrich ThomDietrich referenced this issue in openhab/openhab-docs Sep 13, 2016

Closed

Coding tasks' implementation #85

@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.