Javascript Porter

Javascript Porter Ver 2.0

Source Code


This program search under the preset folder (JSFILEFOLDER) for requested files and send them in order.
This program accepts 3 arguments: l(link list), duplicate and compress.


  • link list

    A list of names of Javascript files needed to be gathered. Do not include file extension (.js), separate with commas.

  • duplicate

    Allow duplication or not (i.e. when the request is “A,B,A”, if duplication is not allowed, the last duplicated A will be ignored). Acceptable values are true | yes | false | no, default is no.

  • noheader

    disable header. Acceptable values are true | yes | false | no, default is no.

  • compress

    Level of compression. Add 1 to remove comment blocks; add 2 to remove comment lines; add 4 to remove indents; add 8 to remove line breakers. i.e. if need to remove all comments, use value 3 (Add 1 and 2). Default value is 0 (no compression).

Request Example


jquery-latest.js and yui-latest.js are requested, allowing duplication, at compression level of 15 and disable header

Change Log

  • Now supports file inclusion, which implements “file dependency” functionality.
    Add single-line inclusion commands to include necessary files. Its syntax is:

    //#include <filename>
    //#include_once <filename>

    filename is the name of the Javascript to be included, without extension .js.
    When using “#include_once”, the file will only be included when that file has not yet been included before.

    If loading file A, B and C, while A and B both need to include D, when processing the “#include_once” command in file B, D will not be included again.

    The inclusion command is find recuisively; if the file being included needs to include other files, those file will be loaded first.
    If any file that is need by one file fails to be loaded, either not existing or unreadable, the whole file is considered failing to be loaded.

  • Change the header to console commands.
  • Added a switch to disable header.

Known Issues

  • It is not recommended using pending in-line comments. In-line comments should take their own lines. Otherwise do not use compression.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.