We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    On further consideration is anyone aware of any issues using the YUI compressor?
    Uses YUI Compressor to clean whitespace and rename internal variables to shorter strings. Does not use eval.

    And finally, does anyone know off the top of their head which bits we could omit for the manager. I’m fairly certain we don’t need every available option from the mootools download page: http://mootools.net/download
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 23491 ☆ A M B ☆
      • 1,056 Posts
      I can’t remember where to find it, but there is a site floating around that will allow you to enter mooTools JavaScript, and it will spit out the dependent components required. That said, we’d then need to run each piece of Manager side JS against the tool and aggregate the results to be conclusive.

      On a personal note, I use custom Modules within the manager and often will include the /manager/.../mootools.js file inside of the Module template. In my opinion, it’d be nice to know that the entire Library/components would be available for use, regardless of whether the native MODx Manager uses them or not.
        Mike Reid - www.pixelchutes.com
        MODx Ambassador / Contributor
        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
        ________________________________
        Where every pixel matters.
        • 5811
        • 1,717 Posts
        On further consideration is anyone aware of any issues using the YUI compressor?
        Quote
        Uses YUI Compressor to clean whitespace and rename internal variables to shorter strings. Does not use eval.

        And finally, does anyone know off the top of their head which bits we could omit for the manager. I’m fairly certain we don’t need every available option from the mootools download page: http://mootools.net/download
        Regarding YUI compressor issues. The current bug list is here (Edit: To get the YUI errors type "compressor" in the trackers search form in the right upper side of the page)

        Regarding the performances between packed and unpacked solutions, I find thisfrench recent study which compares 8 packed solutions :
        YUI Compressor1, Dojo ShrinkSafe2, Packer3, JS Utility v24, LZ77 JS Compressor5, MemTronic JS Cruncher6, JS Min7, and Crunchy8. Look at this study, results are explained in French but figures are understandable by everybody. This study shows that two type of solutions exists :
        - soft solution which simply removes spaces, carriage returns, useless characters and renaming of name variables by shorter variable names.
        - heavy solution like packer which rewrites the js code by changing the coding base.

        - YUI Compressor1, Dojo ShrinkSafe and JS Min are soft solutions.
        - Packer3, JS Utility v24, LZ77 JS Compressor5, MemTronic JS Cruncher6, and Crunchy8 are heavy solutions

        Before gzip, heavys are the fasters

        But the gzip paradox is that after gzipping by the brower the results are opposites and any cases not so differents : Yui compressor results are well compressed rather the code of js utility do not improve more the compression.

        Another point is the time of loading. The soft solution are the best as they haven’t change the structure of the code. So at the end, is it the conclusion of this study, with a gzip compressing by the brower prefers the YUI solutions rather the heavy solution.

        For MODx, an option (I don’t know if it is easy or not to implement) could be to select during the installation process the mootools library type that the user wants and by default choose the no-documentation library rather than the YUI compressed library.

        And If we are going a bit too far ("poussser le bouchon" in French) we can dream that during the installation process, the selection of the snippets and plugins define the list of required functions of mootools grin

        In any cases, i suggest to do many tests ...
          • 5727
          • 160 Posts
          About the YUI / Packer debate, the main difference is that packer is some sort of zip compression which requires processing from the client on every page load, while YUI simply optimize size by shortening variable names, removing space, etc. without touching the logic. As mentioned on the YUI Compressor web page, the best solution is too use gzip compression as part of the HTTP protocol (there’s a line to enable it in MODx root directory .htaccess file) with YUI.

          I’ve read about issues with Packer version and had problems with it myself: inconsistent results & browser hang up. I’ve been using YUI without problems for the last 3 months.

          The web site to check which components are required is Packito:
          http://icebeat.bitacoras.com/mootools/packito/
            Olivier Deland
            Montreal, Canada - Web Developer
            • 5811
            • 1,717 Posts
            Packito address is great and usefull !! Thanks for this tip.
            Isn’t be possible to build on fly, the required mootools library with this kind of solution ?
              • 25663 MODX Staff
              • 12,272 Posts
              Thanks for the feedback. I think the bug list mentioned above is for the YUI JS library, not the YUI compression of a JS library. Confusing eh?

              I’m leaning towards a full distribution of Mootools 1.11 compressed via the YUI compressor since it sounds like it doesn’t actually (in theory anyway) change the code. "In theory ... "

              Actually on 2nd thought, we need to get an interim build out so we’ll just put an uncompressed 1.11 in there and worry about compression later. Unless someone can do some serious diligence and testing in the immediate future. There’s always 0963 ...
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                Ryan, sounds good to me. I second the motion for a full (undocumented), uncompressed 1.11 while we account for the recent security updates in 0.9.6.2.

                What % of savings are we talking in relation to YUI Compressor and mooTools 1.11?
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 5727
                  • 160 Posts
                  Quote from: pixelchutes at Jan 18, 2008, 04:46 PM

                  What % of savings are we talking in relation to YUI Compressor and mooTools 1.11?

                  Full, uncompressed Mootools is 185Kb. (Edit: this is indeed the documented version, undocumented being 87Kb, as mentioned by coroico)
                  Full, YUI Compressed Mootools is 65kb.
                  Packer is 42kb (for reference)
                    Olivier Deland
                    Montreal, Canada - Web Developer
                    • 5811
                    • 1,717 Posts
                    Full, no documentation Mootools is 87Kb.
                    Full, YUI Compressed Mootools is 65kb.

                    So not a big save of bits.
                      • 5811
                      • 1,717 Posts
                      You can’t understand a YUI compressed js file. here is a first extract of the mootools js after YUI compression:
                      //MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
                      
                      var MooTools={version:"1.11"};function $defined(A){return(A!=undefined);}function $type(B){if(!$defined(B)){return false;}if(B.htmlElement){return"element";
                      }var A=typeof B;if(A=="object"&&B.nodeName){switch(B.nodeType){case 1:return"element";case 3:return(/\S/).test(B.nodeValue)?"textnode":"whitespace";}}if(A=="object"||A=="function"){switch(B.constructor){case Array:return"array";
                      case RegExp:return"regexp";case Class:return"class";}if(typeof B.length=="number"){if(B.item){return"collection";}if(B.callee){return"arguments";}}}return A;
                      }function $merge(){var C={};for(var B=0;B<arguments.length;B++){for(var E in arguments[B]){var A=arguments[B][E];var D=C[E];if(D&&$type(A)=="object"&&$type(D)=="object"){C[E]=$merge(D,A);
                      }else{C[E]=A;}}}return C;}var $extend=function(){var A=arguments;if(!A[1]){A=[this,A[0]];}for(var B in A[1]){A[0][B]=A[1][B];}return A[0];};var $native=function(){for(var B=0,A=arguments.length;
                      B<A;B++){arguments[B].extend=function(C){for(var D in C){if(!this.prototype[D]){this.prototype[D]=C[D];}if(!this[D]){this[D]=$native.generic(D);}}};}};

                      So without documentation.