简体   繁体   English

为什么将我的样式表加载到除一页之外的所有其他页面上,我在该页面上获取样式表文件的404

[英]why my style sheets are loaded for all other pages except one page, i get 404 for stylesheet files on that page

I hope you all are doing great, I ran into this wild issue, I'm making my front end in react, and I have several pages in my app, css for all the pages is defined in only one file and I'm loading it from the main HTML document(not react components). 希望大家都做得很好,遇到了这个大问题,我正在尽我所能,并且我的应用程序中有多个页面,所有页面的css仅在一个文件中定义,我正在加载它来自主HTML文档(不是React组件)。 CSS for all the pages is loaded but not for one particular page, the link of that page is sent via email through sendgrid, when I browse the page I get 404 for stylesheet and bootstrap files. 加载了所有页面的CSS,但没有加载特定页面的CSS,该页面的链接是通过sendgrid通过电子邮件发送的,当我浏览该页面时,我会收到404的样式表和引导文件。

This is how I'm loading style sheet from HTML document which hosts the root component of reacting. 这就是我从承载响应根组件的HTML文档中加载样式表的方式。

<html>
  <head>

<link rel="stylesheet" href="app/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="app/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="app/assets/css/style.css">
  </head>
  <body>
     <div id="app-root"></div>

     <script src="/app/bundle.js"></script>
  </body>
</html>

following are the screenshots of the network statistics for the pages which are loaded with css. 以下是随CSS加载的页面的网络统计信息的屏幕截图。 载入CSS的页面

page failed to load with CSS with the same link to CSS files as the that of the prior one. 页面无法加载CSS,并且指向CSS文件的链接与上一个相同。

页面无法使用CSS加载

what seems to be the problem here, thank you, everybody, for taking out time and reading out this. 似乎是这里的问题,谢谢大家,感谢您抽出宝贵的时间来阅读这些内容。

Try doing this 试试这个

<link rel="stylesheet" href="/app/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="/app/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="/app/assets/css/style.css">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 渲染页脚组件除了404页面之外的所有页面反应 - Rendre footer component all page except 404 pages in react 隐藏除第一张图片外的所有图像,直到页面完全加载 - Hide all images except first one till page is fully loaded 如何获得当前页面样式表的字符串? - How do I get my current page stylesheet as a string? 在页面加载之前,我需要处理页面上的网址 - I need to process the urls on my pages before the page is loaded 为什么我的地图可以在一页上显示而在另一页上不能显示 - Why will my map work on one page but not the other 我如何使File.js(Java脚本文件)执行并加载到特定页面中而不加载到其他页面中? - how i make File.js (java script file) execute and loaded in a specific page and not loaded in other pages? 如果我的所有页面都不相同,如何避免使用页面内Javascript并使用外部Javascript文件? - How can I avoid in-page Javascript and use external Javascript files, if all of my pages are different? 获取 web 页面上加载的所有 JS 文件的列表 - Get list of all JS files loaded on a web page 为什么在Angular 2应用程序页面上重新加载IE时出现多个..js.map文件找不到404错误? - Why on Angular 2 app page reload in IE I get multiple ..js.map files not found 404 errors? 为什么我的 Express 服务器对除 index.html 之外的所有文件都响应 404? - Why is my Express server responding with 404 for all files except index.html?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM