Taritsyn / WebMarkupMin

The Web Markup Minifier (abbreviated WebMarkupMin) - a .NET library that contains a set of markup minifiers. The objective of this project is to improve the performance of web applications by reducing the size of HTML, XHTML and XML code.
Apache License 2.0
449 stars 48 forks source link

Error when minify on global level #56

Closed fujoos closed 6 years ago

fujoos commented 6 years ago

The error 'The 'MinifyXmlAttribute' attribute can not be applied to the 'Index' action method of the 'Home' controller, because it returns the result with not supported content type' when applied like this Index Actionresult Function Index() As ActionResult Dim PublicSearchViewModel As New SearchBoxViewModel With {.CurrentQuery = String.Empty, .PlaceHolder = "Search your services like hotel, resorts, events and more", .InstantSearchEnabled = True, .SearchTermMinimumLength = 10, .ShowImagesInInstantSearch = "Yes"} Return View(PublicSearchViewModel) End Function

Public Module FilterConfig Public Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection) filters.Add(New CompressContentAttribute()) filters.Add(New MinifyHtmlAttribute()) filters.Add(New MinifyXmlAttribute()) filters.Add(New HandleErrorAttribute())

    End Sub
End Module

Does an mvc 5 layout page with partial views, partial views with child actions and using constants for magic strings i.e.
@Code Html.RenderPartial(WebHelpers.MetaLayoutPartial) End Code affect the WebMarkupMin or am i ignoring something important?

Taritsyn commented 6 years ago

Hello!

What version of the WebMarkupMin do you use?

Taritsyn commented 6 years ago

Upgrade the WebMarkupMin to version 2.X. About how to do this, see the “How to upgrade applications to version 2.X” section of documentation.

fujoos commented 6 years ago

version 1.1.0.0. got it to work on a controller - action level <CompressContent, MinifyHtml> Public Function Index() As ActionResult Dim PublicSearchViewModel As New SearchBoxViewModel With {.CurrentQuery = String.Empty, .PlaceHolder = "Search your services like hotel, resorts, events and more", .InstantSearchEnabled = True, .SearchTermMinimumLength = 10, .ShowImagesInInstantSearch = "Yes"} Return View(PublicSearchViewModel) End Function

fujoos commented 6 years ago

Ok thanks. Will do. Much appreciated