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

Razor text mode does not minify properly #42

Closed reZach closed 7 years ago

reZach commented 7 years ago

When including html that has this, the minification does not properly account for this (I believe razor needs the @: on a single line by itself, minifying the html causes an error).

I somehow can't get read access to this repository, but you'll need the following code in StreamReaderExtension.cs to fix this:

// Replace Razor "@:" (text mode) instances htmlContents = Regex.Replace(htmlContents, @"@:\s", "{{{TEXT_MODE}}}");

Further below.... htmlContents = htmlContents.Replace("{{{TEXT_MODE}}}", "\r\n@:\r\n");

Deutschi commented 7 years ago

This looks like the same issue that got resolved here a few hours ago. Should be working in the latest release, I wasn't able to test it yet.

deanhume commented 7 years ago

This should be fixed in the latest release - closing for now!