Monthly Archives: October 2011

Require.js and HAML

I’ve been having very good luck with requirehaml. I had been looking around at various templates, but none of them seemed to support compiling before delivery to the client. This script does that and compiles them into easily verifiable javascript files, packaged up to be included with my existing require.js AMD build.

So far, I haven’t actually had that much HTML to include, but hopefully that will change as my project takes shape and grows.

Now I just need to find something to do the same for SASS.

AMD modules and web developers

Now that require.js has reached 1.0, it’s probably time to start shouting its praises from every rooftop so that javascript library authors include support for it. Require.js is an implementation of the AMD draft specification which adds simple module support for javascript in the browser. This means no more namespace pollution (if you use it properly).

Unfortunately, we’re talking about web developers who don’t seem to understand basic principals like avoiding namespace pollution. I mean, how can you even have a conversation with someone with such a misconception of good practices?

Jeremy Ashkenas, the creator of CoffeeScript, Backbone, and Underscore also seems to have misconceptions about the purpose of AMD.

I was really hoping that someone with such a worthy track record would have seen the light by now. Luckily the require.js guy himself is pushing for AMD support in Underscore with a new pull request. Once that is pulled in, it looks like Backbone is next on the list.

Since the next version of jQuery will have AMD support, I imagine that the rest of the libraries will follow since they seem to look up to jQuery for best practices.

And then, one part of the nightmare that is working with javascript will be gone.