As I work on developing my Angular 4 app, I have been exploring ways to apply global styles. Following a helpful tutorial on the Angular site, I created a "styles.css" file in the root directory of my application and linked it in the index.html file:
<link rel="stylesheet" type="text/css" href="styles.css">
After successfully compiling the Angular app with:
$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **
[...]
webpack: Compiled successfully.
However, upon visiting http://localhost:4200 using a Chromium browser, an error regarding the stylesheet appears in the console:
GET http://localhost:4200/styles.css
When using Firefox, the error message provides more details:
GET
http://localhost:4200/styles.css [HTTP/1.1 404 Not Found 15ms]
The resource from "http://localhost:4200/styles.css" was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).
Both the index.html and styles.css files are located in the root directory of my Angular app. I've attempted to find explanations for this issue by checking out additional information:
nosniff
Blocks a request if the requested type is
"style" and the MIME type is not "text/css", or
"script" and the MIME type is not a JavaScript MIME type.
Despite specifying type="text/css"
when linking the stylesheet, I am confused as to why the request is being blocked.