1

Using ASP.NET MVC bundling, is it possible to have minified files where the new line characters are not removed?

I was looking into JsMinify class, but cannot figure out if that is possible to configure.

I want to keep the new line characters for javascript error handling. I am setting up an javascript autotamed error reporting from client side and I would like to see on which line did the error occur.

tereško
  • 58,060
  • 25
  • 98
  • 150
Alvis
  • 3,543
  • 5
  • 36
  • 41
  • 1
    Without removing a newline character it is not a [minification](http://en.wikipedia.org/wiki/Minification_%28programming%29) – Murali Murugesan Oct 03 '13 at 11:48
  • I agree with Murali. One solution for "production" debugging (I can't advise that though) would be to have both minified and orignal file deployed and use a querystring (like ?DebugJS=True) to tell your application to load the full version of the file. This way you do not lose minification ratio and you can still debug if needed. – Superzadeh Oct 03 '13 at 11:49
  • 1
    Is it not? I would still benefit from decreased payload, because of removed white-space chars and shortened variable names. But at the same time I could know exactly at which line of code to look in case of errors. – Alvis Oct 03 '13 at 11:51
  • 1
    The purpose is not debbuging production code. I am setting up a client side error reporting, and I would benefit greatly if the error report could point out the line of code where the error occured. – Alvis Oct 03 '13 at 11:52
  • Oh, then you should add that to the description of your question. By error handling I didn't get that (thought it was "human" error handling). – Superzadeh Oct 03 '13 at 11:53
  • I have clarified my question. Thanks for suggestion, @cahmadzadeh. – Alvis Oct 03 '13 at 11:58
  • You could have a look at the following website: http://refresh-sf.com/yui/. It allows adding a linebreak after a specified column number plus different other options. It is based on YUI, so maybe this API might help you. – Superzadeh Oct 03 '13 at 12:14
  • This question might be useful, and may even be a duplicate: http://stackoverflow.com/questions/10854507/are-there-any-javascript-minifiers-that-preserve-line-breaks – ED-209 Oct 03 '13 at 15:16

0 Answers0