CSI – Client Side Includes

This has plagued me for the past few months and I simply couldn’t find any nice, simple, small solutions available. If your Javascript code consists of separate parts, you probably have them separated into any number of .js files… problem is: If these JS files, like any self-respecting library, want to include other JS files, then all you can do is write down it into a comment. Then, when you start a new project that would benefit from that library, you have to add the library itself via a script tag, look at the comments, find that library that your library needs, add it via a script tag, look at the comments of that library… you see what I’m getting at.

The alternative would be to let a PHP, or other script do that task… but that would either require you to move all your projects to your web directory or run that script every time you want to test your code. Additionally, when an error occurs during runtime, you won’t get the file and line number of your working files, but the one in the compiled file. Not very satisfactory.

Enter CSI – Client Side Includes.

CSI is something in between a library and a framework. It’s tiny (the core is <2k uncompressed) and requires only minimal modifications to your code.

For more details (as well as a demo) and the download, check here.

Leave a Reply

Your email address will not be published. Required fields are marked *

*