first_page

Replacing head.js with concatenated.js in My Studio

In “Introducing head.js to My Studio,” I was optimistic as ever about a new technique that is supposed to make life easier. It did not happen for me. Head JS was having trouble with the beta version of jQuery Color—knowing the details of this problem is irrelevant because when I rolled back to plain <script /> elements everything worked (and I am also certain that I was using the proper Head JS syntax to ensure loading in sequence).

So, instead of getting into yet another intimate relationship with yet another island of JavaScript, my alternative to Head JS is to concatenate my ‘library’ of JavaScript files into one, big-ass file, concatenate.js. This is the PowerShell script that does the job:$newFileName = "concatenated.js" New-Item -ItemType file $newFileName –force $jquery = Get-Content "jquery-1.6.1.min.js" $jqueryrx = Get-Content "jquery.extensions.rx.js" $jqueryui = Get-Content "jquery-ui-1.8.6.custom.min.js" $jquerycolor = Get-Content "jquery.color-2.0b1.min.js" $underscore = Get-Content "underscore-min.js" $jquerytmpl = Get-Content "jquery.tmpl.min.js" Add-Content $newFileName $jquery Add-Content $newFileName $jqueryrx Add-Content $newFileName $jqueryui Add-Content $newFileName $jquerycolor Add-Content $newFileName $underscore Add-Content $newFileName "rn" Add-Content $newFileName $jquerytmplThis very simple alternative does not solve the performance problems that Head JS is meant to solve. But for me, at my current scale of operations, maintainability is more important than maximizing performance.

rasx()