参考网址:
http://www.browsersync.cn/docs/command-line/#watching-files-example
这是我使用的命令
browser-sync start --proxy "localhost:9001" --files "./templates/*.html" --reload-delay 1000
- 其中
--reload-delay 1000
是为了springboot项目热部署的延迟。因为,springboot的热部署没完成,browsersync刷新浏览器,得到的是上一次的结果。 1s延迟,是为了临时解决,等待热部署完成。 - 其中
--proxy "localhost:9001"
是为了代理我的springboot的服务,实际浏览器的地址是 localhost:3000 , 这是browsersync的默认代理地址。 --files "./templates/*.html"
指定监听的文件。
- 注:更多的说明,请参考[browsersync](http://www.browsersync.cn/docs/command-line/#watching-files-example “browsersync” target="_blank")的官网。