paazmaya/grunt-trimtrailingspaces — pull request #13 by croizier (2014-11-09 13:03:28+00:00)
Title: Preserve newlines

We currently process files line by line by splitting and then joining on '\n'.
This is a problem when newline is not '\n', e.g. '\r\n' on Windows. In this case, we replace all newlines with Unix newlines, and change all lines.

Here is a fix.
It replaces manual line-by-line iteration with a global multiline regex that drops trailing space without touching '\r' and '\n'.