Please forgive three VERY naïve questions.
When running AjaxMin from the command line:
a. I need to use full path names containing spaces. AjaxMin errors when it encounters the first space in a path-name, whether or not I enclose the pathname in quotes, e.g.
AjaxMin.exe -JS -global:var1,var2 -clobber:T C:\Documents and Settings\blah.js -out C:\Documents and Settings\blahmin.js
b. What pls is the significance of the * in the command-line syntax? e.g.
-global:IDENT<,IDENT>* or OPTS*
If it is a terminator, is it separated from what precedes it by a space?
c. Are the various opts (JSOPTS, CSOPTS, OPTS) separated from others of the same type by spaces?
Jul 3, 2012 at 3:05 PM
No problem! I'm making assumptions here I probably shouldn't. I guess I need to expand the document page for the command line switches to include the Usage syntax.
a) You absolutely have to enclose path names that include space inside quotes -- that's standard command-line syntax. I know it works; I do it every day and my unit tests all use paths with spaces in them. Your example command line should look like
AjaxMin.exe -JS -global:var1,var2 -clobber:T "C:\Documents and Settings\blah.js" -out "C:\Documents and Settings\blahmin.js"
b) Lower-case letters are exact matches; upper-case letters form identifiers that are defined elsewhere in the syntax. Even thought case is important in this syntax definition, it is not important in the actual command line unless otherwise noted. Things
included between [ and ] are optional; things followed by + mean "one or more"; things followed by * mean "zero or more." Choices are separated by |, and groupings are delimited by parentheses. So in the switch you call out:
The switch explicitly has the characters "-global:" followed by an IDENT, followed by zero or more comma-separated IDENTs. And IDENT is defined elsewhere as:
I do seem to play it a little loose with  and () when I follow the item with * -- I should clean that up. And one last rule: last switch wins. So for example, if your command line looks like this:
AjaxMin -debug:Y -js -clobber -debug:N -new:collapse
then the last -debug switch wins (-debug:N) and debug statements are removed.
Some more examples:
- -clobber[:BOOL] means "-clobber" optionally followed by a colon and a BOOL value. Possible forms of this switch include:
- -inline[:(BOOL|force|noforce)[,(BOOL|force|noforce)]*] means "-inline" at the minimum, optionally followed by a colon and one of BOOL, "force", or "noforce". Optionally after
that can be zero or more comma-separated choices between BOOL, "force", or "noforce". So these are all valid:
- -inline:T,force,F,noforce (because of the last-win rule, the same as -inline:F,noforce)
- -debug[:BOOL[,IDENT[.IDENT]*]*] - "-debug" is the minimum switch. Optionally after that, you can follow it with a colon and a BOOL value. Optionally after
Hope that helps!
Many thanks Ronlo for your most detailed reply to a newbie.
Ajax Minifier is now cutting a swathe through my poorly-written verbose scripts like a well-oiled machine: typical compression 70-75% and improvements in runtime particularly noticable where deeply-nested loops traversing the DOM structure
are involved. (I might just attack some of the latter with jQuery and re-minify).
A great product!