The minifiers is using a C# port of Google’s HtmlCompressor and Crockfords JSMin where there is some JS Code it doesn’t like, the only workaround is to change the variable names to make the minifiers happy.
The C# version is using match.Result which is doing token replacement, such that “$$” becomes “$”. This would cause similar problems if any variables were named, or started with, “$1”.
C# doesn’t have an equivalent of quoteReplacement, so you could probably resort to using Replace, as you only need to escape / and $ (rather than using Regex.Escape).
So, in ServiceStack/Html/Minifiers.html.cs (forum won’t let me link more than 2 things!)
Have to re-open this old thread because I’ve just been caught out by the fix I had suggested.
I was getting a problem with “” escaped within inline scripts, and it’s my own fix! Oops, sorry.
The original issue with $ is still valid, but it’s the backslash that’s the issue. It doesn’t actually get replaced in Regex.Replace like $ does, so is just causing “” to become “\\”.