Is it possible to reference a plain text file as a CSS file within HTML? I have no control over the name or extension of the external CSS file. Take the following as an example:
I have a file called index.html with the following code between the <head> tags:
<head>
<title>Website</title>
<link rel="stylesheet" href="https://example.com/styles">
</head>
The external file at example.com/styles looks like this:
body {
color: red;
font-family: sans-serif;
background: blue;
}
If I open index.html I get the following error in my browser's terminal:
The stylesheet https://example.com/styles was not loaded because its MIME type, “text/plain”, is not “text/css”.
Even if I specify the MIME type with type="text/plain" when referencing the styles file, I still get the same error.
Again, I don't have any control over what the styles file is called, or what it's extension is. All I know is it's URL. Obviously this issue could be mitigated by having a web server download the styles file and then give the local copy a .css extension, but for this project I don't have access to a back-end server.
style.cssto IPFS, I get can then reference that file using the hash of it's content. IPFS strips.cssor any other extension from the file name.