2

My css code is not rendering in the browser and it has something to do with mime types(which i know nothing about). I am using ejs as a template engine.Here's the error i get in console....

Refused to apply style from 'http://localhost:3000/assets/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I'm a NodeJs beginner so maybe thats the problem? Is there a package or any other way to fix this problem? It's not a directory problem because I have followed multiple tutorials and still the same problem.

Jon P
  • 19,442
  • 8
  • 49
  • 72
Yousuf Daramay
  • 127
  • 2
  • 12
  • How are you serving the files? Post your code. – Phix Oct 08 '18 at 22:05
  • 1
    Possible duplicate of [Stylesheet not loaded because of MIME-type](https://stackoverflow.com/questions/48248832/stylesheet-not-loaded-because-of-mime-type) – Spleen Oct 08 '18 at 22:06

1 Answers1

0

If you are using a CSS preprocessor(SCSS, Sass, LESS or POST-CSS) just try recompiling the preprocessor code in the right directory(whichever directory you want to keep the CSS code in)

For me, it just worked after I recompiled it in the right destination.