Skip to content

Support custom elements for whitespace preservation#954

Open
waterkip wants to merge 2 commits into
tdewolff:masterfrom
waterkip:custom-elements
Open

Support custom elements for whitespace preservation#954
waterkip wants to merge 2 commits into
tdewolff:masterfrom
waterkip:custom-elements

Conversation

@waterkip

Copy link
Copy Markdown

This change introduces PreserveWhitespaceTags as a configuration
option to support custom elements that may or may not require whitespace
to function.

I'm building webcomponents and some use templates that becomes <pre>
tags. The problem is that the minifier eats my whitespace and thus the
component loose the formatting they require. This is especially annoying
when I format code:

sub foo {
  my @array = qw(here be dragons);
  return \@array;
}

sub bar {
  my @array = qw(go perl);
  return join(" ", @array);
}

And my custom elements gets:

sub foo {
my @array = qw(here be dragons);
return \@array;
}
sub bar {
my @array = qw(go perl);
return join(" ", @array);
}

So I added support to treat custom elements the same as <pre>-tags.

Signed-off-by: Wesley Schwengle wesleys@opperschaap.net

Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
This change introduces `PreserveWhitespaceTags` as a configuration
option to support custom elements that may or may not require whitespace
to function.

I'm building webcomponents and some use templates that becomes `<pre>`
tags. The problem is that the minifier eats my whitespace and thus the
component loose the formatting they require. This is especially annoying
when I format code:

```perl
sub foo {
  my @array = qw(here be dragons);
  return \@array;
}

sub bar {
  my @array = qw(go perl);
  return join(" ", @array);
}
```

And my custom elements gets:

```perl
sub foo {
my @array = qw(here be dragons);
return \@array;
}
sub bar {
my @array = qw(go perl);
return join(" ", @array);
}
```

So I added support to treat custom elements the same as `<pre>`-tags.

Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant