我有一个使用 Jekyll 构建的 github 页面托管的站点。
我在html-proofer中安装的插件之一。在我将图像切换为使用picturefill之前,这一切正常。
通过使用 Picturefill,我正在使用当前无效的<picture>
标签。这会导致我部署时 html-proofer 失败。
所以我的问题 - 我怎样才能告诉 html-proofer 忽略所有<picture>
标签?
我的设置:
宝石文件:
source 'https://rubygems.org'
gem 'github-pages'
gem 'html-proofer'
.travis.yml:
language: ruby
rvm:
- 2.1
script: script/cibuild
sudo: false
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
脚本/cibuild:
set -e # halt script on error
bundle exec jekyll build
bundle exec htmlproof ./_site
更新:
我发现实际上不是<picture>
导致问题的元素,而是其中的<img>
标签。这是因为<img>
没有 asrc
而是 a srcset
:
<picture>
<!--[if IE 9]><video style="display: none;"><![endif]-->
<source srcset="examples/images/extralarge.jpg" media="(min-width: 1000px)">
<source srcset="examples/images/large.jpg" media="(min-width: 800px)">
<!--[if IE 9]></video><![endif]-->
<img srcset="examples/images/medium.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia">
</picture>
添加data-proofer-ignore
到img
标签可以解决问题,但我宁愿不必在每个实例上都这样做。