Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

573
Visualizações
EJS: How to properly link stylesheets and javascript files in ejs?

I have ran into an issue when using ejs to link external stylesheets and script tags. Here is my link for my stylesheet.

<link rel="stylesheet" href="styles/index.css">

When I highlight the link to the sheet and follow it (in VScode) I am brought to the correct file. I know it is going to the correct location for sure.

However, when I run this on my localhost:5000 I get an error. Here is what the error reads.

Refused to apply style from 'http://localhost:5000/styles/index.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I notice this is pointing to my localhost:5000/styles/index.css, but I do not want it to point to my local host, I want it to point to the directories I have set up in my file structure.

Does anyone know how to resolve this?

Thank you so much for your time.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

if u are trying to use ejs in a nodejs project with express ,u should first define a folder that contain all the static files like css and images then give permission to the browser to get this file .check this: https://expressjs.com/en/starter/static-files.html

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda