gpt4 book ai didi

vim - 当我在 Chrome 中保存对 html 文件的更改时自动重新加载浏览器?

转载 作者:行者123 更新时间:2023-12-03 05:09:34 28 4
gpt4 key购买 nike

我正在 Vim 中编辑 HTML 文件,并且希望浏览器在下面的文件发生更改时刷新。

Google Chrome 是否有一个插件可以监听文件更改并在每次保存文件更改时自动刷新页面?我知道 Firefox 有 XRefresh,但我根本无法运行 XRefresh。

自己编写一个脚本来做这件事有多难?

最佳答案

纯 JavaScript 解决方案!

<强> Live.js

只需将以下内容添加到您的 <head> 中即可:

<script type="text/javascript" src="https://livejs.com/live.js"></script>

How?Just include Live.js and it will monitor the current page including local CSS and Javascript by sending consecutive HEAD requests to the server. Changes to CSS will be applied dynamically and HTML or Javascript changes will reload the page. Try it!

Where?Live.js works in Firefox, Chrome, Safari, Opera and IE6+ until proven otherwise. Live.js is independent of the development framework or language you use, whether it be Ruby, Handcraft, Python, Django, NET, Java, Php, Drupal, Joomla or what-have-you.

我几乎逐字复制了 here 中的这个答案,因为我认为它比这里目前接受的答案更容易、更普遍。

关于vim - 当我在 Chrome 中保存对 html 文件的更改时自动重新加载浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5588658/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com