Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wget downloads CSS @import, but ignores files referenced within them

Tags:

css

wget

I'm using wget as follows:

wget --page-requisites --convert-links -e robots=off \
     --span-hosts --restrict-file-names=windows \
     --directory-prefix=$ASSETS_DIR --no-directories http://myhost/home

The HTML page references a stylesheet file application.css which includes the following:

@import url(https://fonts.googleapis.com/css?family=Quicksand:700);

wget properly creates a file css@family=Quicksand%3A700 with the following contents:

@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 700;
  src: local('Quicksand Bold'), local('Quicksand-Bold'), url(https://themes.googleusercontent.com/static/fonts/quicksand/v3/32nyIRHyCu6iqEka_hbKsonF5uFdDttMLvmWuJdhhgs.ttf) format('truetype');
}

However, wget does not download the actual TTF file referenced here. When I change the CSS on the page being mirrored and paste the @font-face rule directly to application.css, it downloads the TTF file. (But I don't want to do that – I prefer to keep using @import pointed at Google Fonts).

Is there a way to force wget to parse the @imported stylesheet and download its references too?

like image 806
Jan Dudek Avatar asked May 20 '14 08:05

Jan Dudek


1 Answers

Try wget -m -p -E -k -K -np http:\\mysite.com. I had the same problem and this solution worked for me: download webpage and dependencies, including css images

like image 106
William Avatar answered Oct 19 '22 11:10

William