lemonldap-ng/scripts/javascript-indent
2013-10-30 19:44:09 +00:00

20 lines
352 B
Perl
Executable File

#!/usr/bin/perl -w
use JavaScript::Beautifier qw/js_beautify/;
unless ( $ARGV[0] and -e $ARGV[0] ) {
die "Usage $0 <file.js>";
}
open F, $ARGV[0] or die($!);
my $src;
while (<F>) { $src .= $_; }
close F;
open F, ">",$ARGV[0] or die($!);
print F js_beautify( $src, {
indent_size => 1, indent_character => "\t", preserve_newlines => 1 }
);