[英]Why the path is incorrect with gulp and browser-sync
Your style is in the tmp/styles
folder. 您的样式在
tmp/styles
文件夹中。 When your css url is set to ./images/landing.jpg
, that single dot simply means to look in the current folder. 当您将CSS网址设置为
./images/landing.jpg
,该单个点仅意味着在当前文件夹中查找。 So BrowserSync does exactly what you ask and looks for an images folder inside of the styles folder. 因此,BrowserSync完全按照您的要求进行操作,并在styles文件夹内查找images文件夹。 So, it's your CSS that is wrong, not BrowserSync.
因此,错误的是CSS,而不是BrowserSync。
What you actually want is to back out to the parent directory of the styles folder, and look for an images folder there, which is accomplished with two periods: 您真正想要的是退回到styles文件夹的父目录,并在其中查找images文件夹,这需要两个周期才能完成:
background: url("../images/landing.jpg") no-repeat center;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.