Meteor @import css:资源解释为样式表,但使用MIME类型text / html传输:

时间:2022-09-29 19:42:08

I keep seeing this message in my console, although my stylesheet seems to be loading fine (they weren't originally, seems they have to be in the client folder, is that correct?). I'm on Meteor 1.4.2.3.

我一直在我的控制台中看到这条消息,虽然我的样式表似乎正常加载(它们原本不是,似乎它们必须在客户端文件夹中,这是正确的吗?)。我在Meteor 1.4.2.3上。

My folder structure is

我的文件夹结构是

> client
    > styles
         - formStyles.css
         - tableStyles.css
    - main.css
    - main.html
    - main.jsx

In my main.css file I have the following code:

在我的main.css文件中,我有以下代码:

@import "https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css";
@import "styles/tableStyles.css";
@import "styles/formStyles.css";
span{
    color: black;
    font-weight: normal;
}

When I load the page, I get the following warnings in the Chrome Dev Tools Console:

加载页面时,我在Chrome开发工具控制台中收到以下警告:

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

资源解释为样式表,但使用MIME类型text / html传输:“http:// localhost:3000 / styles / formStyles.css”。

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

资源解释为样式表但使用MIME类型text / html传输:“http:// localhost:3000 / styles / tableStyles.css”。

Originally, my styles folder was outside the client folder (under ui) and no styles were applied, but now the styles do get applied but I'd rather not see warnings in my app...

最初,我的样式文件夹在客户端文件夹之外(在ui下)并且没有应用任何样式,但现在样式确实应用但我不想在我的应用程序中看到警告...

I also tried using absolute paths like this @import "{}/styles/formStyles.css"; but it hasn't made a difference.

我也试过使用这样的绝对路径@import“{} /styles/formStyles.css”;但它并没有什么不同。

1 个解决方案

#1


2  

Your css files are placed under client folder, that means you do not have to import anything. Those files will be concatenated automatically for you. You should read this guide: https://guide.meteor.com/structure.html#special-directories

您的css文件放在客户端文件夹下,这意味着您不必导入任何内容。这些文件将自动连接到您。您应该阅读本指南:https://guide.meteor.com/structure.html#special-directories

#1


2  

Your css files are placed under client folder, that means you do not have to import anything. Those files will be concatenated automatically for you. You should read this guide: https://guide.meteor.com/structure.html#special-directories

您的css文件放在客户端文件夹下,这意味着您不必导入任何内容。这些文件将自动连接到您。您应该阅读本指南:https://guide.meteor.com/structure.html#special-directories