2

我有一個網站託管與使用Jekyll建成的github頁面。Ingore標籤使用html-proofer與jekyll

我在html-proofer中安裝的插件之一。這工作正常,直到我切換我的圖像使用picturefill

通過使用Picturefill,我使用了當前無效的<picture>標記。這會導致html-proofer在部署時失敗。

所以我的問題 - 我怎麼能告訴html-proofer忽略所有<picture>標籤?

我的設置:

的Gemfile:

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 

UPDATE:

我發現它實際上並不是引起問題的<picture>元素,而是其中的<img>標記。這是因爲<img>沒有一個src而是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-ignoreimg標籤解決了這個問題,但我寧願沒有這樣做的每一個實例。

+0

無法重現。錯誤日誌會很有幫助。在「」上運行htmlproof成功返回。 – 2015-01-27 01:24:17

+0

「src:圖片網址,這個屬性對於元素是強制性的。在支持srcset的瀏覽器上,如果提供了srcset,src將被忽略。 (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) – 2015-01-27 12:28:30

+0

basszwo:是的 - 這是使用html-proofer而不是我的代碼的問題。我想如果我找不到更好的解決方法,我會記錄一個問題。 – 2015-01-27 22:26:26

回答