The URL of a static resource automatically includes the timestamp when it was last updated providing you access it via $Resource (and similarly $Resource for Lightning) and this ensures that the static resource is re-cached at the client-side when it changes.
Use this mechanism in your logic.
Since $Resource doesn't work in communities, you can create the equivalent URL yourself via querying the static resource's LastModifiedDate:
for (StaticResource sr : [
select LastModifiedDate
from StaticResource
where Name = :name
order by CreatedDate desc
limit 1
]) {
return '/resource/' + sr.LastModifiedDate.getTime() + '/' + name;
}
enter code here
Another option is to have current date in Javascript like following
'/resource/'+Date.now()+'/staticResource'
{!URLFOR(...)}
or hard-coding your own URL?