rehypejs / rehype-minify

plugins to minify HTML
https://unifiedjs.com
MIT License
89 stars 16 forks source link

minify-whitespace add template tag to callapsable list #26

Closed StarpTech closed 5 years ago

StarpTech commented 5 years ago

Input

<h1>
  404
  <template v-if="resource">
    the {{ resource }} was
  </template>
  not found
</h1>

Input

<h1>
  404
  <template v-if="resource">the {{ resource }} was</template>not found
</h1>

This will lead to error 404 the resource wasnotfound because the template tag wasn't identified as a collapsable tag. Due to the fact that we didn't know the context where it is used we should handle it as a collapsable element.

StarpTech commented 5 years ago

I close it. This is the case isn't valid according to HTML specs but for web frameworks. The template tag is a container of content which isn't parsed at runtime so it depends on how the user will use it.

wooorm commented 5 years ago

Hmm, weird!

This is Vue right? Hmm, they’re doing something funky and non-HTML with template tags. Doesn’t Vue also have fragments? Would a fragment (or a span) in this case make more sense?

StarpTech commented 5 years ago

Yes, it's vue and in angular the equivalent is ng-container. A span wouldn't be the same since the user doesn't want to create a real an extra node. In my fork I added the elements to the lists because its no huge change and provide better compatibility for web frameworks.