sourceMappingURL comment not generated, when using with code


In Web Essentials, we are using AjaxMin via code. After minifying JS file, we have to update the code with sourceMappingURL comment at the end of .min.js file: https://github.com/madskristensen/WebEssentials2013/blob/e4e20e10525f2cf57f0b5d69195ab7e842ead02a/EditorExtensions/Misc/Minification/IFileMinifier.cs#L204

Is it possible ask AjaxMin to produce .min.js file with sourceMappingURL pointing to map file?

Here is how we are initiating the source-map package: https://github.com/madskristensen/WebEssentials2013/blob/e4e20e10525f2cf57f0b5d69195ab7e842ead02a/EditorExtensions/Misc/Minification/IFileMinifier.cs#L170-L179

And here is how we are producing settings:


ronlo wrote Oct 27, 2014 at 6:06 PM

So that reference is added by the ISourceMap.EndFile method, which is called in both the EXE and build task codepaths after writing the minified file. I think I just may have missed adding that call to the MinifyFile API. I'll check on adding that.

TheDeeds wrote Oct 27, 2014 at 7:00 PM

Thank you @ronlo. :)

Momentarily, please take a look at https://ajaxmin.codeplex.com/workitem/21198 as well.

ronlo wrote Oct 27, 2014 at 7:04 PM

Will ship with version 5.12, changeset #111265.

TheDeeds wrote Oct 27, 2014 at 11:22 PM

Thank you much ronlo! 8-)

skyaddict wrote Apr 20, 2016 at 2:52 PM

I am using the ajaxmin build task from 5.14.5506.26202 to combine, minify, and create the source map for my javascript. The sourceMappingURL is being added to the min.js file 2 times separated by a blank line,

//# sourceMappingURL=min.js.map

//# sourceMappingURL=min.js.map

Chrome handles this without issue but both IE and EDGE do not find the map unless there is only 1 tag. Is it possible the fix here caused a regression?

skyaddict wrote Apr 20, 2016 at 3:19 PM

I should have mentioned this is how I am calling the build task from MS Build.