Atom + 浏览器同步不重新加载
Atom + Browser-sync not reloading
当我使用以下命令在本地项目文件夹(只是 html/css 项目)中启动浏览器同步时:
browser-sync start --server --files "css/*.css"
这将在终端中输出以下内容后启动网站:
[BS] Access URLs:
-------------------------------------
Local: http://localhost:3000
External: http://192.168.1.13:3000
-------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.13:3001
-------------------------------------
[BS] Serving files from: ./
[BS] Watching files...
当我更改此文件夹中的 CSS 文件时,没有任何反应。当我通过 command-R 手动重新加载页面时,发生了变化。
1) 是什么原因造成的?
编辑:我通过键入以下命令找到了部分解决方案:
browser-sync start --server --files "*.html"
它现在检测 index.html 的变化。它不会从 .css 文件中注入更新,即使我键入以下命令也是如此:
browser-sync start --server --files "*.html CSS/*.css"
我的地图结构如下:
project X
+-- CSS
+-- normalize.css
+-- styles.css
+-- IMG
+-- logo.jpg
+-- pages
+-- index.html
2) 我怎样才能让程序监听 index.html 文件中所做的更改?编辑:已解决
回复 #2:
您是否尝试过将 *.html
添加到要观看的文件中?
$ browser-sync start --server --files "css/*.css, *.html"
所以,我发现问题 1/2 的解决方案如下:
browser-sync start --server --files "*.html css/*.css"
我所有的文件夹名称都需要小写。
当我使用以下命令在本地项目文件夹(只是 html/css 项目)中启动浏览器同步时:
browser-sync start --server --files "css/*.css"
这将在终端中输出以下内容后启动网站:
[BS] Access URLs:
-------------------------------------
Local: http://localhost:3000
External: http://192.168.1.13:3000
-------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.13:3001
-------------------------------------
[BS] Serving files from: ./
[BS] Watching files...
当我更改此文件夹中的 CSS 文件时,没有任何反应。当我通过 command-R 手动重新加载页面时,发生了变化。
1) 是什么原因造成的?
编辑:我通过键入以下命令找到了部分解决方案:
browser-sync start --server --files "*.html"
它现在检测 index.html 的变化。它不会从 .css 文件中注入更新,即使我键入以下命令也是如此:
browser-sync start --server --files "*.html CSS/*.css"
我的地图结构如下:
project X
+-- CSS
+-- normalize.css
+-- styles.css
+-- IMG
+-- logo.jpg
+-- pages
+-- index.html
2) 我怎样才能让程序监听 index.html 文件中所做的更改?编辑:已解决
回复 #2:
您是否尝试过将 *.html
添加到要观看的文件中?
$ browser-sync start --server --files "css/*.css, *.html"
所以,我发现问题 1/2 的解决方案如下:
browser-sync start --server --files "*.html css/*.css"
我所有的文件夹名称都需要小写。