title: Lazy loading JavaScript and Inline JavaScript
body: <p>I noticed in the <code>&lt;head&gt;</code> of my site (for work), there are a lot of <code>&lt;link rel="stylesheet" type="text/css" href="" /&gt;</code> and <code>&lt;script type="text/javascript" src=""&gt;</code> tags.  There are even more JavaScript/CSS files that are only loaded for specific pages (we're using CodeIgniter, and the file paths are passed to the header view).</p>
  
  <p>I was considering using a conditional/asynchronous loader (eg. yepnope.js, head.js, etc.), but I noticed a small problem with doing this.</p>
  
  <p>In our views, there is inline JavaScript, some uses <code>$(function(){})</code> some uses <code>$(document).ready(function(){})</code>, and some just has code (using jQuery) that's not in a <code>ready</code> block.</p>
  
  <p>Without editing EVERY view file to wrap its code in a function and calling that when the JS files are loaded, is there a way to delay the inline code until the JavaScript is asynchronously loaded?</p>