milkshakesoftware/PreMailer.Net

Feature request: remove whitespace

Closed this issue · 6 comments

It is desirable for emails to be as small as possible. However the templates we use to create them have lots of whitespace - obviously because of residue of server-side markup and comments, and whitespace to make it easier to read the template, etc.

Would be useful to have a new argument bool removeWhitespace = false which would strip all whitespace. So the output would be one long line of text.

Would not be a breaking change.

Do you mean removing line breaks? Generally, whitespace includes space characters, tabs, new lines, etc. You definitely do not want to remove all white space characters, right?

Whitespace between tags is useless and should be removed. Whitespace within tags should not be removed.

Not necessarily, e.g. hello world is not the same as helloworld.

Your example is presumably within a tag? If so then it should not be minified.

Here's an example:

Should not be minified:

<span>Hello  

      world</span>

Should be minified:

<span>Hello world</span>         <b>!</b>

<b>Hello</b> <i>world</i> (with a space character between </b> and <i>) is not the same as <b>Hello</b><i>world</i> (without the space character).

I don't think I understand your example? And the tags are not well-formed.

Whitespace between tags is useless and should be removed. Are you saying there are cases where this is not true? I suppose for verbatim text that is the case, but who writes markup like that?

Besides this would be a configurable option.