简体   繁体   English

Angular / Rails应用程序加载空白CSS样式表

[英]Angular/Rails App Loading Blank CSS Stylesheet

In the app I just started I'm having trouble getting my CSS stylesheet to load. 在我刚开始的应用程序中,我无法加载CSS样式表。 I'm used to using the asset pipeline with rails, but I'm trying to use angular for the front end, which has taken everything out of the asset pipeline. 我习惯将资产管道与rails一起使用,但是我试图在前端使用angular,这使资产管道中的所有内容都消失了。

I have the css file in public/app/styles/style.css and am referencing it in my index.html with: 我在public/app/styles/style.css有css文件,并在index.html使用以下文件进行引用:

<link rel="stylesheet" href="app/styles/style.css">

I have images linked successfully with src=app/assets/images/... and if I look in the sources tab on the developer console the file does show up, it just appears to be empty. 我有与src=app/assets/images/...成功链接的src=app/assets/images/... ,如果我在开发人员控制台的“源”选项卡中查看,该文件确实显示了,那么它似乎是空的。

Can anyone see where the disconnect is? 谁能看到断开位置在哪里?

From what I can see with the code, your tag could use a 'type' attribute, but that wouldn't stop it from working. 根据我在代码中看到的内容,您的标记可以使用'type'属性,但这不会阻止其正常工作。

The URL in the link is 'app/styles/style.css', I assume your index.html file is in the 'public' folder? 链接中的URL是“ app / styles / style.css”,我假设您的index.html文件位于“ public”文件夹中?

I'd reality check the URL to ensure it's pointing right to the style.css file, and update the to use the full HTML5 format, which is: 我会现实地检查URL,以确保它正确指向style.css文件,并更新,以使用完整的HTML5格式,即:

<link rel="stylesheet" type="text/css" href="app/styles/style.css">

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM