2016-05-12 84 views
0

当我在本地主机上运行我的应用程序时,出现了2条有关MIME类型的警告。这就是其中之一:使用Meteor更改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控制台在响应头中看到它有content-type: text/html; charset=utf-8,我相信如果我可以将其更改为content-type: text/css; charset=utf-8,那么一切都会很好,但我无法找到如何做到这一点。

+0

BootstrapEssentials文件夹位于名为public的目录中吗? – sheeldotme

+0

@sheeldotme不,应该是?我目前已将它放在我的client.js文件旁边的客户端文件夹中。 –

回答

1

按照流星文档:

称为公共/顶级目录中的所有文件都担任,是给客户端。引用这些资源时,请勿在URL中包含public /,请将URL写入顶层。例如,参考public/bg.png as /bg.png。这是favicon.ico,robots.txt和类似文件的最佳位置。

将您的样式表移动到公共目录中应该有所诀窍!