在 Jekyll 中,如何根据 JEKYLL_ENV 排除文件?

In Jekyll, how to exclude files based on the JEKYLL_ENV?

这似乎是一个非常基本的问题,但我找不到答案:-S

我这样排除:

exclude:
    - "*.json"
    - "Gemfile*"
    - "*.txt"
    - vendor
    - README.md
    - somefile.html

非常简单。要创建生产版本,我 运行:$ JEKYLL_ENV=production bundle exec jekyll build

当我 运行 生产 ENV 时,如何排除 somefile.html 文件

也许您可以尝试使用一个特定的配置文件用于生产,一个用于开发。在生产中,您可以使用 exclude as described here.

排除文件

然后运行:

jekyll build --trace --config _config.yml,_config_dev.yml

jekyll build --trace --config _config.yml,_config_prod.yml

在 _config.yml 中设置通用设置,在带有环境后缀的配置中设置特定于环境的配置。


跟踪标志是可选的,它将有助于设置它,因为它会显示发生的错误。

optional: -t, --trace Show the full backtrace when an error occurs