Make the check for minify/gominify binaries quiet (#1097)

This prevents a message for `minify` not being found from being printed
every time the website is built if you're using `gominify` instead.
This still prints an error if neither `minify` or `gominify` is found.
This commit is contained in:
Hugo Locurcio
2025-06-24 11:22:18 +02:00
committed by GitHub
parent f0ae099812
commit 1416851a72

View File

@@ -8,9 +8,11 @@ Jekyll::Hooks.register :site, :post_write do
Pathname from = Pathname.new(File.join(Dir.pwd, "_site"))
Pathname to = Pathname.new(Dir.pwd)
# Attempt to minify using 'minify', fallback to 'gominify' if not present
minify_command = `which minify`.empty? ? 'gominify' : 'minify'
if `which #{minify_command}`.empty?
puts "Error: Neither 'minify' nor 'gominify' is installed. Please install 'minify'."
`command -v minify`
minify_command = $?.exitstatus != 0 ? 'gominify' : 'minify'
`command -v #{minify_command}`
if $?.exitstatus != 0
puts "ERROR: Neither 'minify' nor 'gominify' is installed. Please install 'minify'."
exit 1
end
`#{minify_command} -r -o #{to.relative_path_from(here)} #{from.relative_path_from(here)}`