从--watch中排除Jekyll目录,但不构建

时间:2016-04-26 09:53:54

标签: html command-line-interface jekyll

我与Excluding a directory from Jekyll watch有一个非常相似的问题,但我认为它有足够的不同以保证它自己的问题。

_config.yml:

exclude: [
  "my_ignored_directory"
]

使用jekyll build --watch,将会在监视任务中成功忽略文件夹my_ignored_directory,但也不会构建它。

是否有办法从--watch任务中排除我选择的文件夹,但是不能将其排除在构建之外?

(注意:控制台中没有错误)

1 个答案:

答案 0 :(得分:3)

答案是否定的,因为排除的观看文件包括:_config.*destination folder(通常为_site)和config['exclude']的内容。

请参阅jekyll-watch code

编辑:但是......

我们可以使用插件覆盖Jekyll::Watcher::custom_excludes方法。

<强> _plugins /化身观察家-override.rb

require 'jekyll-watch'
module Jekyll
  module Watcher
    # replace old method by new method
    # new method is now :custom_excludes
    # overridden method is now :old_custom_excludes
    alias_method :old_custom_excludes, :custom_excludes
    def custom_excludes(options)
      # if we have an "exclude_from_watch" variable in configuration
      if options['exclude_from_watch'] then
        # merge exclude and exclude_from_watch
        (options['exclude'] << options['exclude_from_watch']).flatten!
      end
      # pass the new option array to overridden method
      old_custom_excludes(options)
    end
  end
end

在_config.yml中,只需设置一个exclude_from_watch变量:

exclude_from_watch:
  - css

现在,当jekyll serve exclude_from_watch define query Q-REQ for ENT_RCP_FRN, LIG_RCP_FRN, CONSO_UNV_MDIM, LIG_DOC_TRS, ENT_DOC_TRS scrolling. open query Q-REQ for each ENT_RCP_FRN no-lock where ENT_RCP_FRN.STO-c-CodeDes = "DRET", each LIG_RCP_FRN no-lock break by LIG_RCP_FRN.SKU-c-cod where LIG_RCP_FRN.SOU-c-Cod = ENT_RCP_FRN.SOU-c-Cod and LIG_RCP_FRN.ERF-c-NumRcpFrn = ENT_RCP_FRN.ERF-c-NumRcpFrn, each CONSO_UNV_MDIM no-lock where CONSO_UNV_MDIM.UMA-c-Code = "8B6A9/0001354" and CUMD-c-LstCleCumConso = LIG_RCP_FRN.SKU-c-cod, each LIG_DOC_TRS no-lock LEFT OUTER-JOIN where LIG_DOC_TRS.SKU-c-Cod = LIG_RCP_FRN.SKU-c-Cod, each ENT_DOC_TRS no-lock left outer-join where ENT_DOC_TRS.SOU-c-Cod = LIG_DOC_TRS.SOU-c-Cod and ENT_DOC_TRS.EDT-c-NumDocTrs = LIG_DOC_TRS.EDT-c-NumDocTrs and ENT_DOC_TRS.TR-c-CodeCatDoc = "BT" and ENT_DOC_TRS.STO-c-CodeOri = "DRET" and ENT_DOC_TRS.STO-c-CodeDes = "DWHO". repeat : get next Q-REQ. if not available ENT_RCP_FRN then leave. end. 中的任何文件/文件夹发生更改时,将被忽略。

相关问题