All of this is great for the client side. But how do you define which scripts to include in the LABjs chain on the server side?
Since for work I primarily operate in ASP.Net, I’ve created an ASP.Net solution to the problem, LABjs.Net. This library provides two key controls, LabScriptManager and LabScriptManagerProxy. These controls loosely follow the behavior of the AJAX ScriptManager and ScriptManagerProxy controls, at least their script loading aspects.
Key supported features include:
- Refer to script files using application relative paths (i.e. ~/js/jquery.min.js)
- Load script files from assembly resources
- Specify if debug or release scripts should be used, or use the debug setting from the web.config file
- Ability to set any of the options provided by LABjs
- Include wait() calls in the chain, and provide inline functions to be executed after the wait
- Use LabScriptManagerProxy to add scripts and waits to the chain in content pages and user controls
- Use LabActionGroup inside LabScriptManagerProxy to add script() calls at a specific point in the primary chain
- LABjs debug and release versions are embedded in the DLL and automatically referenced, but you can opti0nally override this with your own URL
- Experimental support for the cdnLABjs library I am working on, which provides automatic failover to a local file if a file fails to load from a CDN (for information about why, see Using CDN Hosted jQuery with a Local Fall-back Copy)
Below you will find links to the current release candidate, 1.0rc1. Please review it and give me any feedback you might have.
Update 2/8/2010: Updated to version 1.0rc4