Minify AND pretty print

Oct 23, 2012 at 11:57 PM

I know that the -pretty option pretty prints the output, but according to the documentation, it disables minification. Is there any way to tell AjaxMin to enable minification and line break the output?

Coordinator
Oct 24, 2012 at 12:19 AM

Absolutely; that's what the "-line" switch is for. The syntax looks daunting, but there are really only three parts:

  1. an optional line length. For instance, if you don't want any line to be much more than 500 characters, you can do -line:500. But that's not what you're asking.
  2. an optional flag indicating Single line or Multiple lines. This is the one you want. Output is single-line by default, so to turn on multi-line mode, use -line:M.
  3. an optional integer indicating the number of spaces to indent when in Multiple-line mode. Default is 4.

So specify -line:m and you'll get the multi-line output you want. You can also mix them. For instance, if you want multi-line format, but lines should break when they get more than 100 characters long, and you want indents to only be two spaces, you could specify -line:100,M,2

http://ajaxmin.codeplex.com/wikipage?title=Command-Line%20Switches

Oct 24, 2012 at 1:52 AM

I missed that one - thanks, works like a charm!