【问题标题】:Atom + Browser-sync not reloadingAtom + 浏览器同步未重新加载
【发布时间】: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


【解决方案1】:

关于#2:

您是否尝试将*.html 添加到要观看的文件中?

$ browser-sync start --server --files "css/*.css, *.html"

http://www.browsersync.io/docs/command-line/#files-example

【讨论】:

    【解决方案2】:

    所以,我发现问题 1/2 的解决方案如下:

    browser-sync start --server --files "*.html css/*.css"
    

    我所有的文件夹名称都必须是小写的。

    【讨论】:

      猜你喜欢
      • 2016-03-26
      • 1970-01-01
      • 2017-11-08
      • 2018-03-27
      • 1970-01-01
      • 2023-04-09
      • 2015-09-11
      • 2023-03-14
      • 1970-01-01
      相关资源
      最近更新 更多