从Jekyll手表中排除目录 [英] Excluding a directory from Jekyll watch
问题描述
我正在使用Jekyll 3.1.1生成博客,最近我引入了一个Git挂钩来自动在推送前发布更改.
I'm using Jekyll 3.1.1 to generate a blog and I recently introduced a Git hook to automatically publish changes pre-push.
引入此钩子后,运行jekyll serve
时开始出现以下错误:
After introducing this hook, I have started getting the following error when I run 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.
奇怪的是,我在_config.yml
中排除了node_modules
:
What's peculiar is that I am excluding node_modules
in _config.yml
:
exclude:
- Gemfile
- Gemfile.lock
- LICENSE
- README.md
- package.json
- Gruntfile.js
- node_modules
node_modules
已正确从构建中排除(即_site
中没有node_modules
子目录).
node_modules
is correctly being excluded from building (i.e. there is no node_modules
subdirectory in _site
).
我也在.gitignore
中排除了node_modules
:
# project
node_modules
_site*
.sass-cache
.jekyll-metadata
# general
.DS_Store
Thumbs.db
ehthumbs.db
基于此GitHub问题和
Based on this GitHub issue and this commit it seems like node_modules
should be excluded from the watch, but it's not. I can't decipher from the documentation if there's another way to exclude files from the watch.
对我来说,从手表中排除目录并避免上述错误的正确方法是什么?
What is the proper way for me to exclude a directory from the watch and avoid the error described above?
推荐答案
_config.yml中的exclude参数的值应为数组,即
The value for exclude parameter in _config.yml should be an array i.e.
exclude: ['_site', 'node_modules', ...]
来源: Jekyll文档-配置
这篇关于从Jekyll手表中排除目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!