I’m trying to do some testing on some JS/HTML code I’m writing, however I was running into quite an annoying problem with CSS. For a while, I wasn’t sure it was being sourced in, however messing around in Developer mode on Brave shows that it is being replaced by the HMTL file code. I can copy/paste in the file contents which works until I refresh. I’m using the following to source it in:
<link rel="stylesheet" href="style.css" />
It’s all located in the same folder for now, however when published:
This is copied code for testing. I’m using this to publish to localhost for testing:
import { createServer } from 'http';
import { readFile } from 'fs';
let port = 8080;
const server = createServer((request, response) => {
response.writeHead(200, {'Content-Type': 'text/html'});
readFile('./index.html', null, function(error, data) {
if (error) {
response.writeHead(404);
response.write('Whoops! File not found!');
} else {
response.write(data);
}
response.end();
});
});
server.listen(port, () => {
console.log(`Server is listening on port number: ${port}`);
});
Any idea what’s going wrong? It’s happening on Edge too. Thanks all.