linkedin/dustjs — pull request #511 by sethkinast (2014-10-17 20:37:38+00:00)
Title: Treat formats and buffers as interchangeable when they are mixed together

During the compiler's optimization pass, "format" globs (basically whitespace) are stripped out. The remaining strings, "buffers", are concatenated into a single entity.
If whitespace compression is disabled, formats and buffers are all written, but the two types are not concatenated together. Because most code is broken up by newlines, this results in highly-inefficient chunking of writes that-- in the case of large templates-- causes Dust to exceed the call stack limit.

This patch adds dust.config.stripWhitespace (set by default for now to true for backwards compatibility; by default there is zero change with or without the patch) to toggle the whitespace stripping behavior. When the flag is set to false (don't strip whitespace), the new format/buffer concat logic is invoked.

Closes #498