GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  JS_COMPACTOR (1)

.ds Aq ’

NAME

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

CONTENTS

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.
<B>--src=filenameB> The source javascript filename. (REQUIRED)
<B>--dest=filenameB> The destination file. Defaults to output to STDOUT.
<B>--forceB> Force overwriting of output file if it exists.
<B>--optB> Same as <B>--remove_comments --replace_white_space --remove_blank_lines --combine_concats --join_all --replace_extra_whitespaceB>
<B>--comment_exception=text_to_matchB> 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.

<B>--remove_commentsB> | <B>--no_remove_commentsB> Remove all comments from the source.
<B>--replace_white_spaceB> | <B>--no_replace_white_spaceB> 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.

<B>--remove_blank_linesB> | <B>--no_remove_blank_linesB> Blank lines in code are removed.
<B>--combine_concatsB> | <B>--no_combine_concatsB> Removes any string literal concatenations. Eg.



    "bob and " +   "sam " + someVar;



Becomes:



    "bob and sam " + someVar



<B>--join_allB> | <B>--no_join_allB> Put everything on one line (retained comments may still contain new lines).
<B>--replace_extra_whitespaceB> | <B>--no_replace_extra_whitespaceB> 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.

Search for    or go to Top of page |  Section 1 |  Main Index


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

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.