Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
JS_COMPACTOR(1)	      User Contributed Perl Documentation      JS_COMPACTOR(1)

NAME
       js_compactor - Command line utility to reduce JavaScript	code to	as few
       characters as possible.

USAGE
	js_compactor -src=source_file [OPTIONS]

SYNOPSIS
       js_compactor [--src=source_file]	[--dest=destination_file] [--opt]
       [--comment_exception=text] [--remove_comments] [--replace_white_space]
       [--remove_blank_lines] [--combine_concats] [--join_all]
       [--replace_extra_whitespace] [--no_remove_comments]
       [--no_replace_white_space] [--no_remove_blank_lines]
       [--no_combine_concats] [--no_join_all] [--no_replace_extra_whitespace]
       [--force] [--help]

DESCRIPTION
       The "--src" option is required.

       Default usage is	as though you specified	"--opt", for optimal settings.
       Setting any of the specific settings will override the default "--opt"
       behavior, and rules will	be applied one by one. You may also specify
       "--opt" and then	disable	specific features with a "--no_option_name"
       style option.

       --src=filename
	   The source javascript filename. (REQUIRED)

       --dest=filename
	   The destination file. Defaults to output to STDOUT.

       --force
	   Force overwriting of	output file if it exists.

       --opt
	   Same	as --remove_comments --replace_white_space
	   --remove_blank_lines	--combine_concats --join_all
	   --replace_extra_whitespace

       --comment_exception=text_to_match
	   Comments matching the provided text will NOT	be removed. The
	   primary purpose for this is to retain copyright notices. Eg.

	       js_compactor --comment_exception=copyright -src=somefile

	   This	option may be specified	multiple times.	Any comment matching
	   any of the provided strings will then be retained.

	   It uses a case insenstive regexp for	the match. This	option has no
	   effect if --no_remove_comments is specified.

       --remove_comments | --no_remove_comments
	   Remove all comments from the	source.

       --replace_white_space | --no_replace_white_space
	   Per each line:

	   o   Removes all begining of line whitespace.

	   o   Removes all end of line whitespace.

	   o   Combined	all series of whitespace into one space	character (eg.
	       s/\s+/ /g)

	   Comments and	string literals	(if still embeded) are untouched.

       --remove_blank_lines | --no_remove_blank_lines
	   Blank lines in code are removed.

       --combine_concats | --no_combine_concats
	   Removes any string literal concatenations. Eg.

	       "bob and	" +   "sam " + someVar;

	   Becomes:

	       "bob and	sam " +	someVar

       --join_all | --no_join_all
	   Put everything on one line (retained	comments may still contain new
	   lines).

       --replace_extra_whitespace | --no_replace_extra_whitespace
	   This	removes	any excess whitespace. Eg.

	       if (someVar = "foo") {

	   Becomes:

	       if(someVar="foo"){

EXAMPLES
       The normal use is probably just for one off squishings:

	   js_compactor	--src=input_file > new_file.js

       If you're squishing something with a copyright, it is recommended that
       you retain that copyright:

	   js_compactor	--comment_exception=copyright --src=input_file > new_file.js

       If you want the code to still be	somewhat readable, it is often helpful
       to retain all the line breaks:

	   js_compactor	--opt --no_join_all --comment_exception=copyright --src=input_file > new_file.js

SEE ALSO
       JavaScript::Squish

BUGS
       Please refer to http://developer.berlios.de/projects/jscompactor/ to
       report bugs.

AUTHOR
       Joshua I. Miller	<jmiller@puriifeddata.net>

COPYRIGHT AND LICENSE
       Copyright (c) 2005 by CallTech Communications, Inc.

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl	version	5.8.3 or, at
       your option, any	later version of Perl 5	you may	have available.

perl v5.32.1			  2008-03-16		       JS_COMPACTOR(1)

NAME | USAGE | SYNOPSIS | DESCRIPTION | EXAMPLES | SEE ALSO | BUGS | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=js_compactor&sektion=1&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help