-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
607af30
commit 0f9d067
Showing
1 changed file
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
require 'html-proofer' | ||
require 'jekyll' | ||
|
||
desc 'Clean up generated site' | ||
Rake.application.options.trace = true | ||
|
||
desc 'Remove all generated files: destination folder, metadata file, Sass and Jekyll caches.' | ||
task :clean do | ||
sh 'rm -rf _site' | ||
Jekyll::Commands::Clean.process({}) | ||
end | ||
|
||
desc 'Build and serve the site' | ||
task serve: [:build] do | ||
Jekyll::Commands::Serve.process({}) | ||
end | ||
|
||
desc 'Build the site' | ||
task build: [:clean] do | ||
Jekyll::Commands::Build.process({}) | ||
end | ||
|
||
task :test do | ||
sh 'bundle exec jekyll build' | ||
HTMLProofer.check_directories( | ||
["./_site"], { | ||
:empty_alt_ignore => false, | ||
typhoeus: { | ||
headers: { | ||
"Accept-Encoding" => "gzip", | ||
} | ||
desc 'Build and test the site' | ||
task test: [:build] do | ||
options = { | ||
:check_html => true, # Validate HTML | ||
:empty_alt_ignore => false, # Allow images with empty alt tags | ||
:check_favicon => true, # Check whether favicons are valid | ||
:check_img_http => true, # Enforce that images use HTTPS | ||
typhoeus: { | ||
headers: { | ||
# This is required to validate links to docs.github.com | ||
"Accept-Encoding" => "gzip", | ||
} | ||
}).run | ||
} | ||
} | ||
HTMLProofer.check_directory("./_site", options).run | ||
end | ||
|
||
task default: :test |