GOAL: Simplify referencing JavaScript libraries from CRM forms for code-centric developer types like me.

I have always been a fan of “code beside” JavaScript files that contain all my main code for a corresponding HTML page.  For example, if I have a page called hello.htm, then I will have a file called hello.htm.js that is the main code file for that page.  One of the things I have always been a bit frustrated with when using this approach is that all the JavaScript libraries my hello.htm.js page uses are actually referenced in the HTML page.  This leads to a lot of switching back and forth between the files when you need to add script references.  It also becomes a burden when you are reviewing code you haven’t worked with in a while.  You inevitably have to switch to the hello.htm page to familiarize yourself with what other js files the page references.  My brain has challenges with this context switch.  Coming from a .NET development background, I am used to namespaces at the top of my C# files that help me with this.  I’ve recently gotten hip to RequireJS which is a library that makes it really easy to add JavaScript references to a page right from JavaScript.  While you can technically do this without RequireJS, the library wraps the verbose code and all the cross browser nuances plus adds some nice features.  Check it out!

Ok, now to the CRM 2011 context…

… read more …