diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Include: Pack JavaScript with ease

Brian Moschel has created and released JavaScript compressor called “Include”, which makes it simple to include and compress JavaScript files no matter how complex the dependencies. Focus on organization with logically separated JavaScript files.

Instead of including files relative to the current page’s url, Include includes files relative to your JavaScript files’ urls. Forget about scanning the page’s script tags for your library’s path. Include lets you organize your scripts however you want.

Include uses Dean Edwards’ Packer to automatically compress your JavaScripts. Never write another server-side compression script. Switch on compress mode and your entire application compresses. The files to compress are determined at runtime, so you can easily compress large libraries with conditional plugins, like TinyMCE*.

  • Consistent script loading order for all browsers (last-in-first-out)
  • FF 1.5+, IE 6+, Opera 9, Safari 3.
  • Works with libraries like Prototype and jQuery.
  • MIT license.
  • 3 KB compressed.
  • Scripts visible in Firebug.

*TinyMCE: TinyMCE is a commonly used Javascript HTML WYSIWYG editor library. This page demonstrates the ease with which you can compress a complex library and its optional components with Include.

How it works? You can include any JavaScript from any other JavaScript with a relative path, then turn on compression. When you reload the page, a window will open that contains a list of the scripts as they are loaded, the uncompressed collection of code, and the code compressed with Packer. You save the compressed code on your server and turn on production mode. Scripts load in the same order across all browsers (last-in first-out), which is nice, considering document.write by default works differently in Opera.

Another aspect we’re excited about is that Include makes it so you’ll never have to write a custom server-side compression script again. Since the scripts to compress are determined at runtime, you can easily compress large libraries with conditional plugins, like TinyMCE.

Instead of duplicating that logic in a server-side script, you can choose your plugins, turn on compress mode, and you’ve got your compressed code. To demonstrate this, we ported TinyMCE and plugins to use Include.


Include, JavaScript, Compressor, Javascript Compressor, Utility, Library, Performance, Optimization

Share This Story, Choose Your Platform!

Do NOT follow this link or you will be banned from the site!