I'm asyncronously loading a css.
@font-face{
src: url('fonts/le-havre-1_300_normal-webfont.eot');
src: url('fonts/le-havre-1_300_normal-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/le-havre-1_300_normal-webfont.woff') format('woff'),
url('fonts/le-havre-1_300_normal-webfont.ttf') format('truetype'),
url('fonts/le-havre-1_300_normal-webfont.svg#LeHavreLight') format('svg');
}
I have to replace the path dynamically, for example:
url(' -> url('http://www.site.com/skin/light/
I wrote this regular expression but it seems to replace only the first value.
var newCss = cssText.replace(/url\(\'(.+)\'\)/g, function(a,b){
return 'url(\''+'http://www.site.com/skin/light/' + b + '\')';
});
How can I replace all the url attributes?