string(19) "ViewArticleOrg.html" Javascript Packer : roojs.org - open source

Published 2010-08-11 00:00:00

Javascript packer in Javascript, with full scoped variable replacement

Source:

git clone http://git.roojs.org/gnome.introspection-doc-generator

http://git.roojs.org/?p=gnome.introspection-doc-generator;a=tree



Usage Example:

seed pack.js -o /compressed/combined.js  *.js

Example Output:

http://www.akbkhome.com/roojs1/roojs-ui.js

Usage

seed pack.js [OPTIONS] LIST_OF_FILES

-o FILENAME
File to output compressed javascript

-O FILENAME
File to output non-compressed file name


-w DIRECTORY
Cache directory (writes minified files in here)

-C
do not clean up cache directory

-f DEPENDANCY FILE
File to read with a list of source paths / or class names.

-p STRING
prefix for translation md5 generator (directory that files are in, and is removed) from path when generating an md5 for the translated name.

-k
keeps the white space in the output files (but does variable replacement).

-t
generate a translation file using double quoted strings

-a
autoBuild - puts target in INPUTDIR/compiled/MODULE-TIMESTAMP.js and turns on translation
code.

-m STRING
module name used with autoBuild to force a module name.

LIST_OF_FILES
files to be compressed.

Notes

This is part of the Javascript toolkit for seed which also includes JSDOC documentation toolkit and API documentation for Gnome seed bindings.


Design

Loosely based off the Yahoo Compressor Java library, using the JSToolkit tokenizer code. Since I hate running Java anywhere, this is a pure Javascript solution, which in theory could be turned into an online version..

It's used primarily for the Roo javascript library building and my Pman Project components.

Performance is acceptable, I've never run any of the other compressors, but it takes around 30 seconds to do the ~170 Javascript files in Roo javascript library.

One key change that's been done is the use of a token tree which makes scope detection considerably simpler.

Recent changes include flagging IE trailing comma detection

Follow us on