Include

Include makes it simple to include and compress JavaScript files no matter how complex the dependencies. Focus on organization with logically separated JavaScript files.

Related

Learn, API

Relative Paths

Instead of including files relative to the current page's url, Include loads 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.

relative paths
Script dependencies with relative paths

Compress Anything Easily

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.

<script src="include.js?myapp,compress" type="text/javascript"></script>
Turn on compress mode
// include 3 JavaScript files
include('../prototype','scripts/jquery','myapp');
if(selected_plugins['fullscreen']);
	include('dependencies','fullscreen');
// conditionally include plugin
if(selected_plugins['search']);
	include('search');

Highlights

Ruby Compressor Script

Some users want to automate their compression in a server-side deployment script, like Capistrano. For this purpose, use Include in combination with this Ruby compressor script. Download the Ruby compressor script and read the included readme.txt file for usage instructions.

Related Learning

API
Low level documentation on the Include methods.

Learn
A usage walkthrough and examples.