deanhume / html-minifier

A simple command line tool to minify your HTML, Razor views & Web Forms views
http://deanhume.github.io/html-minifier/
MIT License
134 stars 86 forks source link

Minification problem #10

Closed danyeah closed 9 years ago

danyeah commented 9 years ago

Hey! When trying to minify the following view:

@using ClassLibrary1
@model IList<GenericViewModel>

<article class="list-widget list-widget--col2">
  <h1 class="list-widget__title">Title</h1>
  @if (Model!= null && Model.Count > 0)
  {
   <ul class="list-widget__list">
     @foreach (var item in Model)
     {
       <li class="list-widget__list-item">
        <a href="@item.Url" class="list-widget__item-link">
          <em class="list-widget__list-item-info">@item.SubTitle</em>
          <span>@item.Title</span>
        </a>
      </li>        
     }
  </ul>  
  }  
</article>

The result was broken

@model IList<GenericViewModel><article 
@using ClassLibrary1 class="list-widget list-widget--col2"><h1 class="list-widget__title">Title</h1> @if (Model!= null && Model.Count > 0) { <ul class="list-widget__list"> @foreach (var item in Model) { <li class="list-widget__list-item"><a href="@item.Url" class="list-widget__item-link"><em class="list-widget__list-item-info">@item.SubTitle</em><span>@item.Title</span></a></li> } </ul> } </article>

The <article here is broken, i temporarily fixed it by switching:

@using ClassLibrary1
@model IList<GenericViewModel>

to

@model IList<GenericViewModel>
@using ClassLibrary1

Which i believe is the last > that causes problem.

deanhume commented 9 years ago

Hi @danielhq Thanks for sending this through - Im currently looking into it!

deanhume commented 9 years ago

Hi @danielhq - The latest release should fix this issue that you were experiencing. I've also added tests to run through the issue that you were experiencing. Thanks!

danyeah commented 9 years ago

Awesome! Thanks