Sha256: 3c050d6231abaeded5be9cbfdc3d88c80beab4cb6eca7940b092097c70335bb7

Contents?: true

Size: 679 Bytes

Versions: 5

Compression:

Stored size: 679 Bytes

Contents

#!/usr/bin/ruby
# frozen_string_literal: true

require 'rubygems'
require 'pathname'
require 'w3c_validators'

# Verify if `file` is valid
def validate(file, ext)
  puts "Validating #{file}..."

  if ext == '.html'
    results = W3CValidators::NuValidator.new.validate_file(file)
  elsif ext == '.css'
    results = W3CValidators::CSSValidator.new.validate_file(file)
  end

  return puts "#{file} is valid!" if results.errors.empty?

  results.errors.each { |err| puts err.to_s }
end

# For every Jekyll directory with source files
Pathname.glob('../{.,_includes,_layouts,_assets}/*.{html,css}').each do |path|
  next if path.directory?

  validate path, File.extname(path)
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vitrina-0.3.1 scripts/validate.rb
lesta-0.1.0 scripts/validate.rb
vitrina-0.3.0 scripts/validate.rb
vitrina-0.2.8 scripts/validate.rb
vitrina-0.2.6 scripts/validate.rb