Results 1 to 1 of 1
Nov 25, 2012, 13:49 #1
- Join Date
- Sep 2008
- 0 Post(s)
- 0 Thread(s)
Slight adjust to: contents.match(/[^\(]+\.(gif|jpg|jpeg|png)/g)
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);
(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:
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'); background-image:url(URL); // no quotes