Your Ad Here

Posted By

pussard on 05/04/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

shalomfriss


Extract CSS Paths


 / Published in: JavaScript
 

Returns an array of all URL image paths to assist in saving all assets from CSS

  1. function extractCssPaths(css) {
  2. var results = css.match(/url\(['"]?[^\s]*['|"]?\)/g);
  3. for (var i = 0, max = results.length; i < max; i++) {
  4. results[i] = results[i].replace(/url\(/, '');
  5. results[i] = results[i].replace(/['|"]/g, '');
  6. results[i] = results[i].replace(/\)/, '');
  7. }
  8. return results;
  9. }

Report this snippet  

You need to login to post a comment.