is there a way to automate changing filenames in <link> , <script> tags
- by nepsdotin
when we use Expires header for text files like js, css, contents are cached in the browser, to get new content we need to change in the html file the new names in the link and script tag. When we add changes. How can we automate it.
I may have some bunch of html files in multiple folders also in subdirectories.
There would be a text file
filelist.txt
OldName NewName
oldfile1-ver-1.0.js oldfile1-ver-2.0.js
oldfile2-ver-1.0.js oldfile2-ver-2.0.js
oldfile3-ver-1.0.js oldfile3-ver-2.0.js
oldfile4-ver-1.0.js oldfile4-ver-2.0.js
The script should change all the oldfile1-ver-1.0.js into oldfile1-ver-2.0.js in the html, php files
I would run this script before i start uploading.
Finally the script could create a list of files and line number where it made the update.
The solution can be in PERL/PHP/BATCH or anything thats nice and elegant