[jQuery] Minifying and packing failed because of Windows line endings
Hi,
just in case someone else is running into this problem. Whenever I
wanted to pack or minify a script of mine I got this error on the
console (using ant):
js: uncaught JavaScript runtime exception: TypeError: Cannot read
property "0.0" from null
With the help of Chris Thatcher I found that the following statement
wasn't executing as expected:
var header = script.match(/\/\*(.|\n)*?\*\//)[0];
It simply didn't match, and I found that this is because for some
reason the file I wanted to pack had line endings of the form "\r\n".
Thus I added a little "\r" to the regular expression to make it work:
var header = script.match(/\/\*(.|\n|\r)*?\*\//)[0];
In the end I converted the line delimiters though. Still I do wonder
if I should add that little change? It took me quite some time to
figure that out.
--Klaus