从Jekyll手表中排除目录

Eri*_*pie 7 jekyll

我正在使用Jekyll 3.1.1生成一个博客,我最近引入了一个Git钩子来自动发布预推更改.

引入此钩子后,我在运行时开始收到以下错误jekyll serve:

Configuration file: /Users/egillespie/Projects/blog.givingjar.org/_config.yml
            Source: /Users/egillespie/Projects/blog.givingjar.org
       Destination: /Users/egillespie/Projects/blog.givingjar.org/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.223 seconds.
        ** ERROR: directory is already being watched! **

        Directory: /Users/egillespie/Projects/blog.givingjar.org/node_modules/git-scripts/bin/hooks

        is already being watched through: /Users/egillespie/Projects/blog.givingjar.org/node_modules/git-scripts/bin/hooks

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
 Auto-regeneration: enabled for '/Users/egillespie/Projects/blog.givingjar.org'
Configuration file: /Users/egillespie/Projects/blog.givingjar.org/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.
Run Code Online (Sandbox Code Playgroud)

什么是特殊的是我排除node_modules_config.yml:

exclude:
  - Gemfile
  - Gemfile.lock
  - LICENSE
  - README.md
  - package.json
  - Gruntfile.js
  - node_modules
Run Code Online (Sandbox Code Playgroud)

node_modules正确地被排除在建筑物之外(即没有node_modules子目录_site).

我也排除node_modules.gitignore:

# project
node_modules
_site*
.sass-cache
.jekyll-metadata

# general
.DS_Store
Thumbs.db
ehthumbs.db
Run Code Online (Sandbox Code Playgroud)

基于这个GitHub问题这个提交似乎node_modules应该从手表中排除,但事实并非如此.如果有另一种方法可以从手表中排除文件,我无法从文档中解读.

从手表中排除目录并避免上述错误的正确方法是什么?

Jab*_*que 3

_config.yml 中排除参数的值应该是一个数组,即

exclude: ['_site', 'node_modules', ...]
Run Code Online (Sandbox Code Playgroud)

来源:Jekyll 文档 - 配置

  • 我使用的语法是在 YAML 中创建数组的另一种方法。不过,我确实按照你的方式尝试过,但仍然收到错误。http://www.yaml.org/spec/1.2/spec.html#id2759963 (2认同)