Skip to content

Instantly share code, notes, and snippets.

@joeyrobert
Created June 7, 2012 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeyrobert/2889227 to your computer and use it in GitHub Desktop.
Save joeyrobert/2889227 to your computer and use it in GitHub Desktop.
beautify javascript directory
#!/usr/bin/env ruby
if ARGV[0]
Dir.glob(ARGV[0]+"**/*.js").each do |file|
puts "Beautifying JS file: #{file}"
puts `js-beautify -s 2 -j -o "#{file}.pretty" "#{file}"`
puts `mv "#{file}.pretty" #{file}`
end
else
puts "Usage: #{__FILE__} directory"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment