【问题标题】:How to Optimize Combres Settings (Compression, Minification)如何优化 Combres 设置(压缩、缩小)
【发布时间】:2010-07-15 21:43:56
【问题描述】:

谁能告诉我最佳的 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>

【问题讨论】:

    标签: asp.net-mvc minify combres


    【解决方案1】:

    在每个 resourceSet 标签中明确设置你的缩小器

    <resourceSet name="jsSet" type="js" version="1" minifierRef="yui" ...
    

    或者使用 defaultJSMinifierRefdefaultCssMinifierRef

    在 resourceSets 标记中全局设置缩小器
    <resourceSets url="~/combres.axd" 
                localChangeMonitorInterval="30"
                remoteChangeMonitorInterval="120"
                defaultDuration="30" 
                defaultVersion="1"
                defaultVersionGenerator="Combres.VersionGenerators.Sha512VersionGenerator"
                defaultJSMinifierRef="yui"
                defaultCssMinifierRef="yui" ...
    

    【讨论】:

    • 有更好的缩小器吗?一种在动态缩小方面具有最佳性能的方法?
    • 我必须说我没有测试整套缩小器。由于缩小后的结果缓存了 30 分钟(在本例中),这是我目前没有考虑的优化。
    • 我认为尽管谷歌闭包编译器需要访问服务器(除非我弄错了,我没有在 Combres 程序集的源代码中看到它)所以它可能是需要考虑的事情
    【解决方案2】:

    我看你有

    defaultDebugEnabled="auto" 
    

    要么将其设置为 true,要么进入 web.config 并关闭调试。

    我发现this 是一个很好的关于如何开始使用梳子的教程。

    【讨论】:

      猜你喜欢
      • 2011-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-15
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 2016-12-21
      相关资源
      最近更新 更多