Search code examples
angularangular-materialangular-material2

Mime type error when Importing CSS in Stackblitz


I would include material design in my Angular project. I'm using Stackblitz online IDE.

The problem is when I include css file I get this error

The stylesheet was not loaded because its MIME type, ”text/html“ is not ”text/css"

Here's my code in index.html:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css">
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
<link "href=node_modules/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet">
</head> 
<my-app>loading</my-app>

and styles.css :

body {
background:#e8e8e8;
font-family: 'Muli';

}


Solution

  • The error is in your html. The href tag is inside your path.

    Change the link to :

    <link href="node_modules/@angular/material/prebuilt-themes/indigo-pink.css" 
          rel="stylesheet"
          type="text/css">