chikun
chikun

Reputation: 199

Log In MIME type (‘text/html’) not a supported stylesheet MIME type

Here is my code snippet I used for my index.html

enter image description here

But whenever I run this application I get below error

enter image description here

Please help

Here is my .angular-cli.json file. It might be some with this code snippet. I tried to figure it out but couldn't. \can somebody help -

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "retro-build-con"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

Upvotes: 0

Views: 1190

Answers (1)

user184994
user184994

Reputation: 18271

It looks like the CSS file you're trying to load is getting redirected to the HTML page (probably due to the routing).

You need to modify the assets block like so:

  "assets": [
    "assets",
    "favicon.ico",
    "css"
  ],

This way, the CSS directory will serve it's static contents correctly

Alternately, you can move the CSS directory inside the assets directory, and change your path to:

href="assets/css/bootstrap.min.css"

Once you've made the change, make sure to stop call ng serve again to restart the dev server

Upvotes: 1

Related Questions