{"id":58,"date":"2008-03-28T12:46:00","date_gmt":"2008-03-28T12:46:00","guid":{"rendered":"http:\/\/www.mohanjith.net\/wordpress\/?p=58"},"modified":"2008-03-28T12:46:00","modified_gmt":"2008-03-28T12:46:00","slug":"recipe-for-compressed-scriptaculous","status":"publish","type":"post","link":"https:\/\/mohanjith.net\/blog\/2008\/03\/recipe-for-compressed-scriptaculous.html","title":{"rendered":"Recipe for compressed script.aculo.us"},"content":{"rendered":"<p>I was searching for a compressed version of <a href=\"http:\/\/script.aculo.us\">script.aculo.us<\/a> javascript library in one file. The search turned out almost fruitless; I found outdated script.aculo.us versions compressed. It was obvious to me that I was on my own. I also wanted to post the method to do it instead of the result.<\/p>\n<p><a href=\"http:\/\/developer.yahoo.com\/yui\/compressor\/\">YUI compressor<\/a> was the best tool I could use to compress any javascript. YUI combined with gzip compression for compatible browsers would produce the smallest on the wire javascript files (See http:\/\/www.julienlecomte.net\/blog\/2007\/08\/13\/).<\/p>\n<p>First attempt to put all the script.aculo.us files into one file failed with mismatched dependencies. I had to find out the correct order to concat the files. As I found out the order should be scriptaculous.js, builder.js, effects.js, controls.js, dragdrop.js, slider.js, sound.js (I have specifically left out unittest.js). If you want you can throw in <a href=\"http:\/\/prototypejs.org\/\">Prototype<\/a> into the mix at the begining as it is required by script.aculo.us (I did that).<\/p>\n<p>Run the following command in a shell prompt from the script.aculo.us root. to concat prototype and script.aculo.us.<\/p>\n<pre> $ cat lib\/prototype.js src\/scriptaculous.js src\/builder.js src\/effects.js src\/controls.js src\/dragdrop.js src\/slider.js src\/sound.js > scriptaculous.bundle.js<\/pre>\n<p> You need to download YUI compressor, run the following command. <\/p>\n<pre> $ java -jar \/path\/to\/yui\/compressor\/build\/yuicompressor.jar scriptaculous.bundle.js -o scriptaculous.bundle.min.js<\/pre>\n<p>In my case I use YUI compressor version 2.3.5 and script.aculo.us 1.8.1, and the file sizes were 244KB scriptaculous.bundle.js and 146KB scriptaculous.bundle.min.js. That&#8217;s a 40% compression.<\/p>\n<p>You need to configure your web server to serve javascript files gzipped for user agents that are accepting gzipped content. You have to do your own reasearch for that :). After gzip compression was turned on for javascript files the size of scriptaculous.bundle.min.js on the wire is 41K, that&#8217;s a 83% compression, wow that&#8217;s alot of saving on bandwidth and loading time.<\/p>\n<p>You can download the compressed and bundled script.aculo.us <a href=\"http:\/\/www.mohanjith.net\/downloads\/script.aculo.us\/1.8.1\/scriptaculous.bundle.min.js\">scriptaculous.bundle.min.js<\/a>. Hope someone will finds it useful.<\/p>\n<div id=\"fb-like\" style=\"\"><iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https:\/\/mohanjith.net\/blog\/2008\/03\/recipe-for-compressed-scriptaculous.html&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:300px; height:30px\"><\/iframe><\/div>","protected":false},"excerpt":{"rendered":"<p>I was searching for a compressed version of script.aculo.us javascript library in one file. The search turned out almost fruitless; I found outdated script.aculo.us versions compressed. It was obvious to me that I was on my own. I also wanted to post the method to do it instead of the result. YUI compressor was the &#8230; <a title=\"Recipe for compressed script.aculo.us\" class=\"read-more\" href=\"https:\/\/mohanjith.net\/blog\/2008\/03\/recipe-for-compressed-scriptaculous.html\" aria-label=\"More on Recipe for compressed script.aculo.us\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[117,116,115],"tags":[429,428,427],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-compress","category-scriptaculous","category-yui","tag-compress","tag-scriptaculous","tag-yui"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5lUHm-W","jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/posts\/58","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/comments?post=58"}],"version-history":[{"count":0,"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"wp:attachment":[{"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohanjith.net\/blog\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}