我有这个问题。Chrome继续返回此错误
资源解释为样式表,但以MIME类型text/html传输
受此错误影响的文件只有Style、chosen和jquery-gentleselect(以相同方式导入索引的其他CSS文件工作良好且没有错误)。我已经检查了我的MIME类型和文本/css已经在css上。
老实说,我想从理解问题开始(这似乎是我一个人做不到的事情)。
我有这个问题。Chrome继续返回此错误
资源解释为样式表,但以MIME类型text/html传输
受此错误影响的文件只有Style、chosen和jquery-gentleselect(以相同方式导入索引的其他CSS文件工作良好且没有错误)。我已经检查了我的MIME类型和文本/css已经在css上。
老实说,我想从理解问题开始(这似乎是我一个人做不到的事情)。
当前回答
我在一个。net应用程序中遇到了同样的问题,一个叫做MojoPortal的CMS开源程序。在我的一个特定网站的主题和皮肤中,在浏览或测试时,它会像窒息一样磨碎和变慢。
我的问题不是CSS的“类型”属性,而是“其他东西”。我的具体变化在Web.Config中。我将MinifyCSS, CacheCssOnserver和CacheCSSinBrowser的所有值都更改为FALSE。
一旦设定好了,网站再次快速投入生产。
其他回答
使用角
在我的情况下,使用ng-href而不是href解决了这个问题。
注意:
我和laravel一起做后台
我在恢复一个旧的MEAN堆栈项目时遇到了同样的问题。我使用nodemon作为我的本地开发服务器,得到了相同的错误资源解释为样式表,但使用MIME类型text/html传输。我从nodemon更改为http-server,可以在这里找到。它立刻对我起了作用。
I faced the same issue while configuring Postfix Admin 3.2. According to the official documentation, the whole Postfix Admin content should be extracted into a separate directory, i.e. /srv/postfixadmin and not the document root. Only the /srv/postfixadmin/public directory should be symlinked into /var/www/html document root. I have just extracted the whole content into /var/www/html. Having played with Nginx server block settings, I managed example.com/postfixadmin resolving from /var/www/html/postfixadmin/public. Nevertheless, images and CSS were not available with 404 status code. The stylesheets were broken. I got the error message OP quoted with respective 404 entries in access log.
在我的情况下,我只是移动/var/www/html/postfixadmin到/srv/postfixadmin和ln -s /srv/postfixadmin/公共/var/www/html/postfixadmin。这完全解决了问题。 这是参考资料。
我在为一个用npm安装的React布局模块加载CSS时遇到了这个问题。你必须导入两个.css文件来让这个模块运行,所以我最初导入它们是这样的:
@import "../../../../node_modules/react-grid-layout/css/styles.css";
但发现文件扩展名必须被删除,所以这是有效的:
@import "../../../../node_modules/react-grid-layout/css/styles";
使用ReactJs,当我添加样式文件到index.html使用相对链接,如
<link rel="stylesheet" href="./css/style.css"> .
然后我导航到一条路线,说;localhost:3000/artist和刷新,我得到错误。
错误消失后,我取代相对链接与绝对链接说;
<link rel=“stylesheet” href=“http://localhost/project/public/css/style.css”。