全局安装


1
npm install -g browser-sync

项目中安装


1
npm install --save-dev browser-sync

启动 BrowserSync


1
2
3
4
5
6
7
8
9
//监听一个文件
browser-sync start --server --files "css/*.css"

//监听多个文件
// 如果你的文件层级比较深,您可以考虑使用 **(表示任意目录)匹配,任意目录下任意.css 或 .html文件。
browser-sync start --server --files "**/*.css, **/*.html"

//指定端口
browser-sync start --server --port "3031" --files "**/*.css, **/*.html"

中文官网文档


www.browsersync.cn

评论和共享

  • 第 1 页 共 1 页
作者的图片

Archie Shi

Nothing to say


Front-End Development Engineer