Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjason limmm
8,009 Pointsunable to load stylesheet and js script on static server because of 'mime type'?
when i tried to load my website everything worked out fine but my stylesheet wasn't loading when i check the chrome dev tools they said it's because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.( i just copy and pasted the text from the console by the way)
here is my code:
layout.pug
doctype html
html
head
title Probability Game!
link(rel='stylesheet', href='static/stylesheet/style.css')
body
block content
coingame.pug
extends layout
block content
h1 Coin Game!
h2 How many rows and columns you want?
form
div#rows
label#rowlabel(for='rows') Rows:
input#rows(type='text')
div#columns
label#columnlabel(for='columns') Columns:
input#columns(type='text')
script(src='static/js/coingamebehavior.js')
app.js
app.use('/static', express.static('public'));
app.use(bodyparser.urlencoded({extended:false}));
app.use(cookieparser());
app.set('view engine', 'pug');
app.listen(port, ()=>{
console.log(`app is listening on port ${port}`)
});
const mainroute = require('./routes/index.js');
const coingame = require('./routes/coingame.js');
app.use('/', mainroute);
app.use('/coingame', coingame);
1 Answer
Rich Donnellan
Treehouse Moderator 27,696 PointsA quick search yielded this thread on SO:
https://stackoverflow.com/questions/56091351/issue-with-linking-a-css-file-to-a-pug-file
Hopefully, this helps your case too.