Auto-reload browser when I save changes to html file, in Chrome?

后端 未结 23 2081
半阙折子戏
半阙折子戏 2020-12-12 11:46

I\'m editing an HTML file in Vim and I want the browser to refresh whenever the file underneath changes.

Is there a plugin for Google Chrome that will listen for ch

23条回答
  •  执念已碎
    2020-12-12 12:20

    Handy Bash one-liner for OS X, assuming that you have installed fswatch (brew install fswatch). It watches an arbitrary path/file and refreshes the active Chrome tab when there are changes:

    fswatch -o ~/path/to/watch | xargs -n1 -I {} osascript -e 'tell application "Google Chrome" to tell the active tab of its first window to reload'
    

    See more about fswatch here: https://stackoverflow.com/a/13807906/3510611

提交回复
热议问题