【发布时间】:2015-09-16 14:42:43
【问题描述】:
当我使用以下命令在本地项目文件夹(只是 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 文件中所做的更改?编辑:已解决
【问题讨论】:
-
您的 css 文件是否在 css 文件夹中?他们有 .css 扩展名吗?
-
是的,它们都有 .css 扩展名。
标签: html css browser-sync