【问题标题】:Meteor Resource interpreted as Stylesheet but transferred with MIME type text/htmlMeteor 资源被解释为样式表,但使用 MIME 类型 text/html 传输
【发布时间】:2014-02-06 19:18:48
【问题描述】:

我正在使用流星,我的静态文件位于公共目录中:

// Directory Structure

app
    app/.meteor
    app/server
    app/client
    app/packages
    app/lib
    app/public
        app/public/styles
        app/public/images

在我的index.html 上,我有这个:

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

我仍然收到此错误:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/public/styles/app.css".

我该如何解决这个问题?流星公共目录的正确用法是什么?

【问题讨论】:

    标签: javascript meteor


    【解决方案1】:

    您请求的目录不正确。 Meteor 提供 HTML 就像它使用任何不指向文件的路径一样。

    URL 路径应该指向

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

    public 中的所有内容都应映射到 /

    【讨论】:

    • 我的样式表在&lt;link href="/client/stylesheets/bootstrap.css" rel="stylesheet"&gt;,因为建议将所有样式表移到这个结构中。我怎样才能摆脱同样的错误?
    • 谢谢!我希望我早一个小时看到这个!
    猜你喜欢
    • 2017-04-19
    • 2018-01-23
    • 2012-05-20
    • 2014-11-19
    • 2013-05-04
    • 2011-12-13
    • 2017-10-12
    • 2016-03-19
    • 2021-04-25
    相关资源
    最近更新 更多