为什么gulp和browser-sync的路径不正确

时间:2015-08-20 23:10:20

标签: gulp browser-sync

这是我的gulp和browser-sync代码 enter image description here

现在,为什么这条路径的错误: enter image description here

当前目录结构是这样的:

enter image description here

和css风格:

enter image description here

1 个答案:

答案 0 :(得分:0)

您的样式位于tmp/styles文件夹中。当您的css网址设置为./images/landing.jpg时,该单个点只是意味着查看当前文件夹。因此,BrowserSync完全按照您的要求进行操作,并在styles文件夹中查找images文件夹。所以,这是你的CSS错了,而不是BrowserSync。

你真正想要的是退回到styles文件夹的父目录,并在那里查找一个images文件夹,用两个句点完成:

background: url("../images/landing.jpg") no-repeat center;