Commit be919274 authored by Xavier Guimard's avatar Xavier Guimard

Add javascript indenter

parent 1487e055
......@@ -686,3 +686,6 @@ tidy: clean
find lemon*/ -type f \( -name '*.pm' -or -name '*.pl' -or -name '*.t' \) -print -exec perltidy -b {} \;
find lemon*/ -name '*.bak' -delete
tidy-js: clean
find lemon*/ -type f -name '*.js' ! -name 'jq*' -print -exec scripts/javascript-indent {} \;
#!/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 }
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment