Search Results

Search found 2 results on 1 pages for 'deepwell'.

Page 1/1 | 1 

  • Replace url() relative path with full domain in css files

    - by deepwell
    I'd like to run a script on release that replaces all url() declarations in a css file with the full domain path, because images are hosted on a static web server. Example Current: background-image: url(/images/menu.gif); Desired: background-image: url(http://example.com/images/menu.gif); Current: background-image: url('/images/menu.gif'); Desired: background-image: url('http://example.com/images/menu.gif'); Current: background-image: url("/images/menu.gif"); Desired: background-image: url("http://example.com/images/menu.gif"); I have concocted a bash script using sed to do just that, but it does not handle url with quotes url(''), or urls that already have a full path. STATIC_HOST="http://example.com" sed -i '' "s|url(\([^)]*\)|url($STATIC_HOST\1|g" main.css

    Read the article

1