This project has moved and is read-only. For the latest updates, please go here.

MicrosoftAjaxJsMinifier .map file configuration

Dec 5, 2013 at 5:16 PM
Can't find a way to let MicrosoftAjaxJsMinifier generate .map file...
Dec 5, 2013 at 5:29 PM
Using of .map files are not provided by Microsoft ASP.NET Web Optimization Framework's architecture (same applies to the Bundle Transformer). You need to look at things realistically.
Dec 5, 2013 at 5:35 PM
i'm realistic: MicrosoftAjaxJsMinifier generate .map files

Bundle Transformer does not need to handle those .map files it only should let generate them...
Dec 5, 2013 at 5:44 PM
Bundle Transformer does not write the results of their work in the file system, but passes them to Microsoft ASP.NET Web Optimization Framework.

For your tasks need a completely different product (something like a Grunt).
Jun 4, 2014 at 8:52 AM
Have you seen this example of how it can be implemented:
Jun 4, 2014 at 9:21 AM
NeZz_DK wrote:
Have you seen this example of how it can be implemented:
No, I haven't , very interesting, I'll give it a try
Thanks for the suggestion!
Jun 4, 2014 at 10:40 AM
Hello, NeZz_DK!

AspNetBundling is a bad example. I will explain why:
  1. This library is compared to the Bundle Transformer has a very simple architecture. It is not produce multi-stage processing of assets (translation, postprocessing and minification), when need to pass a new source map on each stage;
  2. Source map write to the file system (I have already written about);
  3. Using of CssRewriteUrlTransformFixed item transformation changes CSS-code before concatenation and minification, that makes a source map is wrong.
Actually, I think it is incorrect to give the example of project from GitHub, which has no stars.
Oct 8, 2014 at 12:54 AM
Edited Oct 8, 2014 at 12:57 AM
Good points @Taritsyn.
  1. Not sure what you mean here, could you please clarify? Do you mean I should output source maps at each stage of the bundling process, for instance at time of transformation in CssRewriteUrlTranformFixed as well, so that they can them become input to the next stage and maintain the complete mapping? If so, yes that's something I should definitely look at and would fix 3 as you mentioned.
  2. What is wrong here? I write the sourcemaps to the filesystem and they get referenced and pulled in by the browser correctly.
  3. Good point, transforms will break this mapping, I'd need to write the transformed files to the filesystem and have the sourcemap refer to them. The problem is nothing is stopping a dev from putting any transform in the pipeline there to obfuscate the mapping.
    Anyway I'm currently indicating that CSS source mapping doesn't work, as AjaxMin didn't have support for it when I first wrote the library. What I would say though, is that you could still have it work to some degree, just needs some work.
Anyway, when I have time I'll need to have a proper review of all this and make sure it works. I was mostly just concerned with getting an example up of how you could do these things, but since MS is abandoning the AspNet bundling framework, I've already moved to grunt as you said. It's a better option.

Apr 16, 2015 at 10:51 AM

I agree that writing to the filesystem for the sourcemap is not a great solution for this problem. However, I recently learned you can add your sourcemap files as base64-encoded urls to the minified file:

Here's a javascript thing that does it:
//@ sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmb28uanMiLCJiYXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O1VBQ0c7Ozs7Ozs7Ozs7Ozs7O3NCQ0RIO3NCQUNBIn0=
This way you can embed it in the minified file itself and everything fits in the standard bundling/minification pipeline.