I have a script which will read the contents of a CSS file and pull out all the URLs (it then preloads those images).
I believe this part of it grabs all the URLs:
var images = contents.match(/[^\\(]+\\.(gif|jpg|jpeg|png)/g);
...I also believe that grabs the URL ending with the file extension.
(1) I want to be able to grab a version number appended to the file.
(2) I also want to be able to add some form of instruction to the end of a URL to for example tell the script not to pre-load that particular image etc.
So, instead of only ever being able to get the filename and ending with the extension, I want to be able to write that line of code above so it can pull out something like this:
I think I just need that line adjusting slightly? Any ideas? I can do the rest.
Important: a version number and extra stuff after the extension may not always exist. Also, I want it to take into account different ways of writing the CSS, such as this:
background-image:url(URL); // no quotes
This topic is now closed. New replies are no longer allowed.