Skip to content

Commit

Permalink
Refactor Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
parkerbxyz committed Oct 27, 2022
1 parent 607af30 commit 0f9d067
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions Rakefile
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

0 comments on commit 0f9d067

Please sign in to comment.