Emacs 如何让Phoenix live重新加载忽略临时文件?
Emacs在编辑缓冲区时生成临时文件,例如,编辑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中修改正则表达式,以仅匹配不包含#的
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中的正则表达式;DRTL;博士
这样做:
~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中的正则表达式;博士