Changing MIME type with Meteor

When I'm running my app on localhost, I get 2 warnings concerning MIME type. This is one of them:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/BootstrapEssentials/bootstrap.css".

The other warning is identical with a different file. Both files are in my working directory. So far, I have been to these similar questions but they haven't helped:

Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)

Chrome says "Resource interpreted as script but transferred with MIME type text/plain.", what gives?

Resource interpreted as stylesheet but transferred with MIME type text/html

Originally I was trying to use this line:

<link rel="stylesheet" href="/BootstrapEssentials/bootstrap.css">

I have since added in the type field:

<link rel="stylesheet" href="/BootstrapEssentials/bootstrap.css" type="text/css">

but that didn't do anything. I also have used the JavaScript Console to see that in the response header it has content-type: text/html; charset=utf-8 content-type: text/html; charset=utf-8 and I believe that if I can change that to being content-type: text/css; charset=utf-8 content-type: text/css; charset=utf-8 then everything will be fine but I can't find how to do that either.


As per the Meteor docs:

All files inside a top-level directory called public/ are served as-is to the client. When referencing these assets, do not include public/ in the URL, write the URL as if they were all in the top level. For example, reference public/bg.png as /bg.png. This is the best place for favicon.ico, robots.txt, and similar files.

Moving your stylesheets to a directory in public should do the trick!

链接地址: http://www.djcxy.com/p/8244.html

上一篇: 如何通过浏览器确定上传文件的MIME类型?

下一篇: 使用Meteor更改MIME类型