It's a Prepending Party

I just realized a very powerful and simple feature of CodeKit that has made my life immensely easier, as well as giving a speed boost to my sites.

You can prepend all the libraries you’re using on a project at the top of your main javascript file like so:

// @codekit-prepend "mootools-core-1.5.0.js"
// @codekit-prepend "mootools-more-1.5.0.js"
// @codekit-prepend "shadowbox.js"
// @codekit-prepend "chosen.js"
// @codekit-prepend "slider.js"

And then set the output to be Minified + source map (for easier debugging):

Codekit options for javascript

And then in your footer you can get all your behavior with one HTTP request:

<script src="<?php echo MEDIA_URL; ?>/js/min/application-ck.js" type="text/javascript"></script>

Stupid simple, but for some reason it just hit me that this was possible, and now I use it all the time. I love finding new ways to improve my workflow with CodeKit.

(Underwear drawer notes: yes, I still use MooTools on several of my older sites, as well as scrappy ol’ PHP. I have been wooed to jQuery and sexier Ruby + Python methods of coding over the years, but it’s good to keep a wide variety of skills in your tool belt.)