CSS Is Not Loading in App

Blazor css file not updating when app is launched

If you are not seeing changes that you have applied to the app.css file, you may need to clear your browser cache, manually.

A better solution is to use versioning as shown below:

<link rel="stylesheet" type="text/css" href="css/app.css?version=0.1">

Add a version number as a query parameter. This will force the browser to look for the latest version of the style sheet ...

Why my css file is not loading when deployed in heroku? P.S: I'm using ejs

After rigorous research and trying so many ways finally I'm able to resolve my issue by myself.

I have done some major changes, and my issue was resolved.

  • I have changed my file structure a little bit.

  • From this to this

  • I have created a new directory called partials in the views directory and moved my header.ejs and footer.ejs files to that directory.

  • In header.ejs file I have changed the code from this


  • <link href="css/styles.css" rel="stylesheet" type="text/css" >

    to

    <link href="/css/styles.css" rel="stylesheet" type="text/css" >
  • In other .ejs files I have included the header.ejs and footer.ejs as follows:

    <%- include("partials/header"); -%>
    <%- include("partials/footer"); -%>

And that's how I am able to solve my issue.

Hakuna Matata

CSS not loading with node.js and express

Change app.get('/', (request, responseC) => { to app.get('/style.css', (request, responseC) => {



Related Topics



Leave a reply



Submit