Combres Compression Causing jQuery problems

Jan 21, 2011 at 4:02 PM

Here's my Combres.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<combres xmlns='urn:combres'>
  
  <filters>
    <filter type="Combres.Filters.FixUrlsInCssFilter, Combres" />
  </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="yui" type="Combres.Minifiers.YuiJSMinifier, Combres">
      <param name="IsVerboseLogging" type="bool" value="false" />
      <param name="IsObfuscateJavascript" type="bool" value="true" />
      <param name="PreserveAllSemicolons" type="bool" value="false" />
      <param name="DisableOptimizations" type="bool" value="true" />
      <param name="LineBreakPosition" type="int" value="-1" />
    </minifier>
  </jsMinifiers>
  <resourceSets url="~/combres.axd" defaultDuration="30"
                                defaultVersion="auto"
                                defaultDebugEnabled="false"
                                defaultCssMinifierRef="off" 
                                defaultJSMinifierRef="off"> 
    <resourceSet name="siteCss" type="css" minifierRef="yui">
      <resource path="~/css/jquery-ui-1.7.2.custom.css"  />
      <resource path="~/css/OMNIv2.css" />
      <resource path="~/css/dataTable.css" />
    </resourceSet>
    <resourceSet name="siteJs" type="js" >
      <resource path="~/js/jquery-1.4.2.min.js" minifierRef="off" />
      <resource path="~/js/jquery.jstree.min.js" minifierRef="off" />
      <resource path="~/js/jquery.dataTables.min.js" minifierRef="off" />
      <resource path="~/js/jquery.cookie.min.js" minifierRef="off" />
      <resource path="~/js/jquery-ui-1.7.2.custom.min.js" minifierRef="off" />
      <resource path="~/js/jquery.collapsible-v.2.1.3.js" minifierRef="yui" />
      <resource path="~/js/jquery.fileupload.js" minifierRef="yui" />
      <resource path="~/js/original/OMNIv2.js" minifierRef="yui" />
    </resourceSet>
  </resourceSets>
</combres>
With defaultDebugEnabled set to false, i.e. the module will now start running... inline Javascript and one of my ClientRegisterScriptBlocks blow up saying that '$ is undefined'. Obviously, the jQuery hasn't been loaded. If I actually run this with defaultDebugEnabled set to true, the combined JS runs fine and all references work. Is there any idea as to why this is happening? The log shows nothing out of the ordinary.

defaultDebugEnabled="false"
defaultDebugEnabled="false"
Jan 22, 2011 at 1:19 PM

If defaultDebugEnabled is true, then no minification is made.  So if there's the error when defaultDebugEnabled is false, it's probably because the minification doesn't work well with your resources.  You can try changing minification type (e.g. from yui to msajax, or closure/local-closure).   If it still doesn't work, try split resources into different sets to see what resource(s) is not supposed to be combined with the rest in the set.   

Jan 22, 2011 at 3:39 PM

I realized after extensive testing that only the cookie.js and custom.js were being included in the combined file. I'm not exactly sure what's going on. When I only used the jquery file, it was included, but I couldn't get anything else to combine with it.