美文网首页编程语言爱好者让前端飞
VS Code 快速搭建本地服务插件-live-server

VS Code 快速搭建本地服务插件-live-server

作者: 张中华 | 来源:发表于2020-07-02 22:41 被阅读0次

    market address: https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer
    setting doc:https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md

    可快速启动本地服务, 且可以像react、vue脚手架,不需要去浏览器刷新就可以同步更新html内容到界面。

    安装方式:
    npm install -g live-server或yarn global add live-server
    启动方式:
    live-server 或 live-server --port=8080
    参数:

    --port=NUMBER - select port to use, default: PORT env var or 8080
    --host=ADDRESS - select host address to bind to, default: IP env var or 0.0.0.0 (“any address”)
    --no-browser - suppress automatic web browser launching
    --browser=BROWSER - specify browser to use instead of system default
    --quiet | -q - suppress logging
    --verbose | -V - more logging (logs all requests, shows all listening IPv4 interfaces, etc.)
    --open=PATH - launch browser to PATH instead of server root
    --watch=PATH - comma-separated string of paths to exclusively watch for changes (default: watch everything)
    --ignore=PATH - comma-separated string of paths to ignore (anymatch-compatible definition)
    --ignorePattern=RGXP - Regular expression of files to ignore (ie .*\.jade) (DEPRECATED in favor of --ignore)
    --middleware=PATH - path to .js file exporting a middleware function to add; can be a name without path nor extension to reference bundled middlewares in middleware folder
    --entry-file=PATH - serve this file (server root relative) in place of missing files (useful for single page apps)
    --mount=ROUTE:PATH - serve the paths contents under the defined route (multiple definitions possible)
    --spa - translate requests from /abc to /#/abc (handy for Single Page Apps)
    --wait=MILLISECONDS - (default 100ms) wait for all changes, before reloading
    --htpasswd=PATH - Enables http-auth expecting htpasswd file located at PATH
    --cors - Enables CORS for any origin (reflects request origin, requests with credentials are supported)
    --https=PATH - PATH to a HTTPS configuration module
    --proxy=ROUTE:URL - proxy all requests for ROUTE to URL
    --help | -h - display terse usage hint and exit
    --version | -v - display version and exit
    

    测试结果:


    文件结构
    测试结果

    相关文章

      网友评论

        本文标题:VS Code 快速搭建本地服务插件-live-server

        本文链接:https://www.haomeiwen.com/subject/zgvdqktx.html