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

后端 未结 23 2146
半阙折子戏
半阙折子戏 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:35

    If you have Node installed on your computer, then you can use light-server.

    Setp 1: Install light-server using command npm install -g light-server

    Step 2: While current working directory is the folder containing the static HTML page, start light-server using command npx light-server -s . -p 5000 -w "*.css # reloadcss" -w "*.html # reloadhtml" -w "*.js # reloadjs"

    Step 3: Open the web page in browser at http://localhost:5000


    In Step 2,

    Port can be changed using -p switch

    Files that are being watched can be changed using -w switch

    Server directory can be changed using -s switch

    Documentation for light-server is at https://www.npmjs.com/package/light-server

提交回复
热议问题