Possible issues with JS conditional Compilation

Apr 5, 2012 at 1:46 AM

Hi,

While running Ajaxmin to minify JS files, I am getting the below mentioned error:

JS1107: Expecting more source characters

I verified the JS file and it has valid @if tag and @end tag in the file, but AjaxMin is giving run time errors for the same. For now, I have added -ignore:JS1107 in my Ajaxmin command. Any pointers for resolving this problem will be great.

Thanks!

Coordinator
Apr 12, 2012 at 4:58 PM

Can you send me a sample source file? I'll take a look at this as soon as I can get to it. Arbitrary conditional-compilation isn't really supported -- only a few common scenarios. I just need to see what you are doing, exactly, to see if that isn't currently supported, if it's a bug in AjaxMin, if there's a tweak I can suggest to make it supported, or if there's something I can do to add support for it.

[I just got back from a two-week vacation, so I apologize for the delay.]

Coordinator
Apr 13, 2012 at 9:23 PM

Okay, I see the problem. It's a bug in how AjaxMin handled single-line conditional-compilation comments that end with an EOF rather than a new line. Your source file ends with //@end followed immediately with the EOF -- there's no newline after the single-line conditional-compilation comment, and AjaxMin is choking on that. If you make sure that final //@end has a newline after it rather than just ending the file, that will work around this issue. Or just use the multi-line syntax: /*@end@*/. Either way will get you moving again.

But I'll also get a fix into AjaxMin for the bug.

Coordinator
Apr 17, 2012 at 12:59 AM

This is fixed in release 4.48.