lib/nanoc/checking/checks/external_links.rb in nanoc-4.5.0 vs lib/nanoc/checking/checks/external_links.rb in nanoc-4.5.1
- old
+ new
@@ -1,8 +1,7 @@
require 'net/http'
require 'net/https'
-require 'nokogiri'
require 'timeout'
require 'uri'
module ::Nanoc::Checking::Checks
# A validator that verifies that all external links point to a location that exists.
@@ -10,9 +9,11 @@
# @api private
class ExternalLinks < ::Nanoc::Checking::Check
identifiers :external_links, :elinks
def run
+ require 'nokogiri'
+
# Find all broken external hrefs
# TODO: de-duplicate this (duplicated in internal links check)
filenames = output_filenames.select { |f| File.extname(f) == '.html' && !excluded_file?(f) }
hrefs_with_filenames = ::Nanoc::Extra::LinkCollector.new(filenames, :external).filenames_per_href
results = select_invalid(hrefs_with_filenames.keys)