popeindustries/inline-source — pull request #5 by laneboysrc (2014-11-02 00:10:00+00:00)
Title: Fix issue with html.replace mangling '$&'

The following JS code fails when inlined:

e&$&&(console.log("Hello world"));
^^ This $& is a special flag for String.replace, which means "Inserts the matched substring."
Source:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter

This bug was discovered by using gulp-inline-source, which uses inline-source
and uglify.js.
The original code was something like

if (variable & mask) {
doSomething()
}

Uglify.js, automatically called from gulp-inline-source. optimized that as
follows:

e&$&&(doSomething());

'variable' was shortened to 'e', 'mask' shortened to '$', and the 'if'
replaced with '&&'. The final inlined source replaced the $& with the
original