Open SplendidDream opened 1 year ago
<pre
and <textarea
should already not have their whitespace collapsed. Are you saying this is not working? <template
is missing and will be collapsed. This can be fixed.
this: <div style=""{{if !show}}display:none;{{/if}}"">
is invalid HTML and i can't predict NUglify's output in this regard
By set the TagsWithNonCollapsibleWhitespaces
property, <pre>
and <textarea>
tags are supported to keep whitespace, but still compress the children tags, for example:
Input:
<pre>
<span style=""""> name: Tom </span>
<p></p>
</pre>
Output:
<pre>
<span> name: Tom </span>
<p>
</pre>
The <span>
and <p>
tags are still minified. I need <pre,<textarea,<template
tag to keep the children tags without any change.
{{...}}
are template engine syntaxes such as Handlebars/Vue Template, which save template content via <template>
tags.
The children tag may not be standard html before it is rendered, so the raw content needs to be kept. For example, streamline the following code, the UglifyResult
instance has two errors, but is legal as a template engine syntax.
<template id="tpt">
<div style=""{{if !show}}display:none;{{/if}}"">
name: {{data.name}}
</div>
</template>
If HtmlSettings
class provides a setting property that keep children tags in their raw format, the UglifyResult
instance will not return an error. This could be an enhancement.
NUglify version 1.21.0
Enhancement Is it possible to keep tag elements in their raw format output without minify them, e.g.
template, pre, textarea
? The reason, maybe some tags have template variables or are used to display source code or do not allow changes to the content.To Reproduce
Minified output result.Code:
result .Errors:
Excepted code The following settings are supported:
result.Code:
Code implementation Maybe the code needs to be changed like this: