M
M
Maxim Zolotoy2018-04-09 23:16:01
Web development
Maxim Zolotoy, 2018-04-09 23:16:01

How to solve the problem of caching scripts and styles when updating the site?

When I update the site - I have to rename the style files and scripts - so that other people would immediately see the site normally - but I'm already tired of doing this. Maybe there is some generally accepted way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
riot26, 2018-04-09
@spacenear

GET parameters. There are even automated solutions
<script src="/script.js?v=12345"></script>

I
Igor Vorotnev, 2018-04-10
@HeadOnFire

GET parameters will work, riot26 's answer is essentially correct. But it is GET parameters that have a drawback - Google PageSpeed ​​Test and similar tools swear and explain the reason. Personally, I prefer the other way - to use a unique identifier as part of the file name, and at the server level, route the request to the desired file. You can read more here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question