روش کمپرس کردن html در mvc5 بطوریکه وقتی inspect گرفتیم html را بصورت کمپرس شده ببینیم
ما معمولا از Gzip استفاده میکنیم
ممنون.
من از MinifyHtmlAttribute استفاده کردم همه چیز درسته فقط خروجی نمیده.میشه کمکم کنید
[MinifyHtmlAttribute]
بالای اکشنم از این استفاده کردم
متاسفانه من از minify تا حالا استفاده نکردم
تنظیمات web.config ام:
<webMarkupMin xmlns="http://tempuri.org/WebMarkupMin.Configuration.xsd"> <webExtensions enableMinification="true" disableMinificationInDebugMode="true" enableCompression="true" disableCompressionInDebugMode="true" maxResponseSize="100000" disableCopyrightHttpHeaders="false" /> <core> <css> <minifiers> <add name="NullCssMinifier" displayName="Null CSS Minifier" type="WebMarkupMin.Core.Minifiers.NullCssMinifier, WebMarkupMin.Core" /> <add name="KristensenCssMinifier" displayName="Mads Kristensen's CSS minifier" type="WebMarkupMin.Core.Minifiers.KristensenCssMinifier, WebMarkupMin.Core" /> </minifiers> </css> <js> <minifiers> <add name="NullJsMinifier" displayName="Null JS Minifier" type="WebMarkupMin.Core.Minifiers.NullJsMinifier, WebMarkupMin.Core" /> <add name="CrockfordJsMinifier" displayName="Douglas Crockford's JS Minifier" type="WebMarkupMin.Core.Minifiers.CrockfordJsMinifier, WebMarkupMin.Core" /> </minifiers> </js> <html whitespaceMinificationMode="Medium" removeHtmlComments="true" removeHtmlCommentsFromScriptsAndStyles="true" removeCdataSectionsFromScriptsAndStyles="true" useShortDoctype="true" useMetaCharsetTag="true" emptyTagRenderMode="NoSlash" removeOptionalEndTags="true" removeTagsWithoutContent="false" collapseBooleanAttributes="true" removeEmptyAttributes="true" attributeQuotesRemovalMode="Html5" removeRedundantAttributes="true" removeJsTypeAttributes="true" removeCssTypeAttributes="true" removeHttpProtocolFromAttributes="false" removeHttpsProtocolFromAttributes="false" removeJsProtocolFromAttributes="true" minifyEmbeddedCssCode="true" minifyInlineCssCode="true" minifyEmbeddedJsCode="true" minifyInlineJsCode="true" processableScriptTypeList="" minifyKnockoutBindingExpressions="false" minifyAngularBindingExpressions="false" customAngularDirectiveList="" /> <logging> <loggers> <add name="NullLogger" displayName="Null Logger" type="WebMarkupMin.Core.Loggers.NullLogger, WebMarkupMin.Core" /> <add name="ThrowExceptionLogger" displayName="Throw exception logger" type="WebMarkupMin.Core.Loggers.ThrowExceptionLogger, WebMarkupMin.Core" /> </loggers> </logging>
و همینطور :
<compilation debug="false" targetFramework="4.5.2" />
و این رو هم در nuget ام update کردم:
WebMarkupMin.Web
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)