Skip to content

Alters the urls for CSS and JS files to include the version number in it. /file.css?v=123 -> /file.v-123.css requires rewrite rules.

Notifications You must be signed in to change notification settings

tryonegg/static-cache-version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Static Cache Version

Alters the urls for enqueued CSS and JS files moving the version number from the query string to be part of the file url. /file.css?v=123 -> /file.v-123.css Requires the following rewrite rules:

Apache

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)\.(v-\d+|\d+)\.(js|css|cur|bmp|gif|ico|jpe?g|png|svgz?|webp)$ $1.$3 [L]
</IfModule>

Nginx add this to a server block

rewrite ^(.+)\.(v-\d+|\d+)\.(js|css|cur|bmp|gif|ico|jpe?g|png|svgz?|webp)$ $1.$3 last;

About

Alters the urls for CSS and JS files to include the version number in it. /file.css?v=123 -> /file.v-123.css requires rewrite rules.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages