Как оптимизировать настройки Combres (сжатие, минификация)
Кто-нибудь может сказать мне наиболее оптимальные настройки Combres? У меня есть следующее, но кажется, что мой CSS и мой JS не минимизируются.
<?xml version="1.0" encoding="utf-8" ?>
<combres xmlns='urn:combres'>
<filters>
<filter type="Combres.Filters.FixUrlsInCssFilter, Combres" />
<filter type="Combres.Filters.DotLessCssFilter, Combres" acceptedResourceSets="dotLessCss" />
</filters>
<cssMinifiers>
<minifier name="yui" type="Combres.Minifiers.YuiCssMinifier, Combres">
<param name="CssCompressionType" type="string" value="StockYuiCompressor" />
<param name="ColumnWidth" type="int" value="-1" />
</minifier>
</cssMinifiers>
<jsMinifiers>
<minifier name="msajax" type="Combres.Minifiers.MSAjaxJSMinifier, Combres" binderType="Combres.Binders.SimpleObjectBinder, Combres">
<param name="CollapseToLiteral" type="bool" value="true" />
<param name="EvalsAreSafe" type="bool" value="true" />
<param name="MacSafariQuirks" type="bool" value="true" />
<param name="CatchAsLocal" type="bool" value="true" />
<param name="LocalRenaming" type="string" value="CrunchAll" />
<param name="OutputMode" type="string" value="SingleLine" />
<param name="RemoveUnneededCode" type="bool" value="true" />
<param name="StripDebugStatements" type="bool" value="true" />
</minifier>
</jsMinifiers>
<resourceSets url="~/Extras"
defaultDuration="30"
defaultVersion="auto"
defaultDebugEnabled="auto" >
<resourceSet name="siteMaster.Js" type="js">
<resource path="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" mode="dynamic" />
<resource path="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" mode="dynamic" />
<resource path="~/Assets/Scripts/jquery.corner.js" />
<resource path="~/Assets/Scripts/MyApp.Combined.Master.js" />
</resourceSet>
<resourceSet name="mobileMaster.Js" type="js">
<resource path="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" mode="dynamic" />
<resource path="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" mode="dynamic" />
<resource path="~/Assets/Scripts/jquery.corner.js" />
<resource path="~/Assets/Scripts/MyApp.Combined.Master.js" />
</resourceSet>
<resourceSet name="siteMaster.Css" type="css">
<resource path="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/base/jquery-ui.css" mode="dynamic" />
<resource path="~/Assets/Css/Site.css" />
</resourceSet>
<resourceSet name="mobileMaster.Css" type="css">
<resource path="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/base/jquery-ui.css" mode="dynamic" />
<resource path="~/Assets/Css/Mobile.css" />
</resourceSet>
<resourceSet name="bingMaps.js" type="js">
<resource path="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2" mode="dynamic" />
<resource path="~/Assets/Scripts/Bing-Maps.js" />
</resourceSet>
</resourceSets>
</combres>
2 ответа
Решение
Либо установите явно свои минифайеры в каждом теге resourceSet
<resourceSet name="jsSet" type="js" version="1" minifierRef="yui" ...
Или настройте минифайеры глобально в теге resourceSets, используя defaultJSMinifierRef и defaultCssMinifierRef
<resourceSets url="~/combres.axd"
localChangeMonitorInterval="30"
remoteChangeMonitorInterval="120"
defaultDuration="30"
defaultVersion="1"
defaultVersionGenerator="Combres.VersionGenerators.Sha512VersionGenerator"
defaultJSMinifierRef="yui"
defaultCssMinifierRef="yui" ...
Я вижу, у вас есть
defaultDebugEnabled="auto"
Либо установите для него значение true, либо перейдите в web.config и отключите отладку.
Я обнаружил, что это отличный учебник о том, как начать работать с combres.