Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Emacs 如何让Phoenix live重新加载忽略临时文件?_Emacs_Elixir_Phoenix Framework_Livereload - Fatal编程技术网

Emacs 如何让Phoenix live重新加载忽略临时文件?

Emacs 如何让Phoenix live重新加载忽略临时文件?,emacs,elixir,phoenix-framework,livereload,Emacs,Elixir,Phoenix Framework,Livereload,Emacs在编辑缓冲区时生成临时文件,例如,编辑a.html.eex将生成。\a.html.eex。不幸的是,由于文件扩展名匹配,在这种情况下也会触发Phoenix live重新加载。有没有办法让live reload忽略这些文件,从而禁用此行为?您可以在config/dev.exs中修改正则表达式,以仅匹配不包含的路径 在config/dev.exs中,更改: ~r{web/templates/.*(eex)$} 致: 您可以在config/dev.exs中修改正则表达式,以仅匹配不包含#的

Emacs在编辑缓冲区时生成临时文件,例如,编辑
a.html.eex
将生成
。\a.html.eex
。不幸的是,由于文件扩展名匹配,在这种情况下也会触发Phoenix live重新加载。有没有办法让live reload忽略这些文件,从而禁用此行为?

您可以在
config/dev.exs
中修改正则表达式,以仅匹配不包含
的路径

config/dev.exs
中,更改:

~r{web/templates/.*(eex)$}
致:


您可以在
config/dev.exs
中修改正则表达式,以仅匹配不包含
#
的路径

config/dev.exs
中,更改:

~r{web/templates/.*(eex)$}
致:

TL;博士 这样做:

~r{web/templates/([^/]+/)*(?!\.\#)[^/]*\.eex$}
解释 建议使用如下正则表达式:

~r{web/templates/.*(eex)$}
本例中的问题是
*
部分与任何匹配,包括
/
, 但是我们需要能够在文件名的开始处捕获

因此,我们采取以下措施:

  • 匹配初始路径片段
    …web/templates
  • 递归到子目录中
  • 忽略以
    开头的任何内容#
  • 接受扩展名为
    .eex
    的任何文件
  • 作为扩展正则表达式编写,即:

    ~r{
      web/templates/
      ([^/]+/)*        # recurse into directories
      (?!\.\#)         # ignore Emacs temporary files (`.#` prefix)
      [^/]*            # accept any file character
      \.eex$           # accept only .eex files
    }x
    
    这就是我放在
    config/dev.exs
    中的内容,但是,如果您想更简洁,请使用TL中的正则表达式;DR

    TL;博士 这样做:

    ~r{web/templates/([^/]+/)*(?!\.\#)[^/]*\.eex$}
    
    解释 建议使用如下正则表达式:

    ~r{web/templates/.*(eex)$}
    
    本例中的问题是
    *
    部分与任何匹配,包括
    /
    , 但是我们需要能够在文件名的开始处捕获

    因此,我们采取以下措施:

  • 匹配初始路径片段
    …web/templates
  • 递归到子目录中
  • 忽略以
    开头的任何内容#
  • 接受扩展名为
    .eex
    的任何文件
  • 作为扩展正则表达式编写,即:

    ~r{
      web/templates/
      ([^/]+/)*        # recurse into directories
      (?!\.\#)         # ignore Emacs temporary files (`.#` prefix)
      [^/]*            # accept any file character
      \.eex$           # accept only .eex files
    }x
    
    这就是我放在
    config/dev.exs
    中的内容,但是,如果您想更简洁,请使用TL中的正则表达式;博士