Stylesheet not updating

后端 未结 14 1433
一个人的身影
一个人的身影 2020-11-28 04:10

I am creating a website, but when I made changes to the stylesheet on my site, and I refreshed the site, none of the changes were there.

I tried to use the view sour

14条回答
  •  感动是毒
    2020-11-28 04:48

    I ran into this problem too, a lot of people seem to recommend force reloading your page, which won't fix the issue in cases such as if you're running it on a server. I believe the optimal solution in this scenario is to timestamp your css.

    1. This is how I do it in my Django template:

    Where adding ?{% now 'U' %} to the end of your css file would fix this issue.

    1. How you would do it with just CSS (hopefully someone edits this to a cleaner version, this looks a little janky but it does work, tested it):

    Where ?Wednesday 2nd February 2020 12PM (current date) seems to fix the issue, I also noticed just putting the time fixes it too.

提交回复
热议问题