Now that I defined my static website, I need a way to test any changes that I will do in future. Here are the high level requirements that I want to cover:
After a little research I found out that html-proofer is doing a good job so far.
Configuring
- I’m using Gemfiles to manage my gems, so:
gem 'html-proofer', '~> 3.0', '>= 3.0.5'
- Using Jekyll as framework my generated files are saved under
_sites
folder, so this command will actually runhtmlproofer
over my files, ignoring some predefined urls, hashtags or return code:$ bundle exec htmlproofer ./_site --url-ignore '/#blog/,/paulbrodner.github.io/,/fb.me/' --http-status-ignore 999
- After each commit, I want to automatically test my changes, so I’ve added Travis as my Continous Integration system.
language: ruby
rvm:
- 2.4.1
# I am using using bundler, therefore
# the `install` step will run `bundle install` by default.
script:
- bundle exec jekyll build
- bundle exec htmlproofer ./_site --disable-external --url-ignore '/#blog'
# branch whitelist, only for GitHub Pages
branches:
only:
- master
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
sudo: false # route your build to the container-based infrastructure for a faster build
In scripts
section above, I first build my static website which is saved into “_sites” folder then I call htmlproofer on it to do his magic.
The entire source-code can be found on #10 merge-request