wget下载CSS @import,但忽略其中引用的文件

时间:2014-05-20 08:43:56

标签: css wget

我正在使用wget,如下所示:

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

HTML页面引用样式表文件application.css,其中包括以下内容:

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

wget使用以下内容正确创建文件css@family=Quicksand%3A700

@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');
}

但是,wget不会下载此处引用的实际TTF文件。当我更改正在镜像的页面上的CSS并将@font-face规则直接粘贴到application.css时,它会下载TTF文件。 (但我不想这样做 - 我更喜欢继续使用@import指向Google字体。

有没有办法强制wget解析@import ed样式表并下载其引用?

1 个答案:

答案 0 :(得分:2)

试试function alist ($array) { $alist = "<ul>"; for ($i = 0; $i < sizeof($array); $i++) { $alist .= "<li>$array[$i]"; } $alist .= "</ul>"; return $alist; } //Try to get ImageMagick "convert" program version number. exec("convert -version", $out, $rcode); //Print the return code: 0 if OK, nonzero if error. echo "Version return code is $rcode <br>"; //Print the output of "convert -version" echo alist($out); 。我有同样的问题,这个解决方案对我有用:download webpage and dependencies, including css images

相关问题