用 Meteor 改变 MIME 类型

Changing MIME type with Meteor

当我 运行 我的应用程序在本地主机上时,我收到 2 个关于 MIME 类型的警告。这是其中之一:

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

另一个警告与不同的文件相同。这两个文件都在我的工作目录中。到目前为止,我已经回答过这些类似的问题,但没有帮助:

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

最初我试图使用这一行:

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

我已经在类型字段中添加了:

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

但这并没有起到任何作用。我还使用 JavaScript 控制台在响应 header 中看到它有 content-type: text/html; charset=utf-8,我相信如果我可以将其更改为 content-type: text/css; charset=utf-8 那么一切都会好起来的但我也找不到该怎么做。

根据 Meteor 文档:

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.

将样式表移动到 public 中的目录应该可以解决问题![​​=11=]