Skip to content

Commit 1416851

Browse files
authored
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.
1 parent f0ae099 commit 1416851

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

_plugins/minify-assets.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
Pathname from = Pathname.new(File.join(Dir.pwd, "_site"))
99
Pathname to = Pathname.new(Dir.pwd)
1010
# Attempt to minify using 'minify', fallback to 'gominify' if not present
11-
minify_command = `which minify`.empty? ? 'gominify' : 'minify'
12-
if `which #{minify_command}`.empty?
13-
puts "Error: Neither 'minify' nor 'gominify' is installed. Please install 'minify'."
11+
`command -v minify`
12+
minify_command = $?.exitstatus != 0 ? 'gominify' : 'minify'
13+
`command -v #{minify_command}`
14+
if $?.exitstatus != 0
15+
puts "ERROR: Neither 'minify' nor 'gominify' is installed. Please install 'minify'."
1416
exit 1
1517
end
1618
`#{minify_command} -r -o #{to.relative_path_from(here)} #{from.relative_path_from(here)}`

0 commit comments

Comments
 (0)