I'm using Express.js & static path is set.
What i'm trying to do:
- Serve 2 .hbs files --> (index.hbs & about.hbs)
- Load a Partial in both of them (header)
- Apply a little css file
What's Happening:
- CSS is loaded on index.hbs while partial is not loaded on it.
- CSS is NOT loaded on about.hbs while partial is being loaded.
- Receiving this error on about.hbs console window: Refused to apply style from 'http://localhost:3000/public/css/homePageStyles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Setting Static Path:
const staticPath = path.join(__dirname, "../public")
app.use(express.static(staticPath))
Folder Structure:
Full Source Code Link: https://github.com/jeeemmyy/7.-Partials
See Question&Answers more detail:os