/ Published in: JavaScript
Returns an array of all URL image paths to assist in saving all assets from CSS
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function extractCssPaths(css) { var results = css.match(/url\(['"]?[^\s]*['|"]?\)/g); for (var i = 0, max = results.length; i < max; i++) { results[i] = results[i].replace(/url\(/, ''); results[i] = results[i].replace(/['|"]/g, ''); results[i] = results[i].replace(/\)/, ''); } return results; }