← back to all talks and articles

Introducing μtil

Lately in my web development work I find myself needing some simple JavaScript tools. Usually I bring out jQuery, but sometimes it just doesn’t feel right to load an entire library in order to show and hide some elements.

That is why I recently started developing a tiny JavaScript toolkit of my own, called μtil (mu-til). It’s purpose is to make basic DOM operations a little easier without taking on too much bloat. You can find the μtil at Github.

Why a new library?

There’s more than enough JavaScript libraries out there, but here’s why I wrote one:

I’ll still be using bigger frameworks of course, but on some cases μtil will suffice and I will enjoy creating a as-lean-as-possible website.


μtil only does a couple of things, all of which I have stolen from the big guys:

μtil doesn’t do Ajax or effects. If I need that I’m much better off with jQuery. Most of the features are extensions on the core library, and it’s nice and easy to add more.


Here’s a quick code sample from the project README to show off:

// on page load
$(function() {

  // Select all links in the content leader
  $('#content p.leader a')

    // observe the click event
    .addEvent('click', function(e) {

      // stop event propagation and prevent default link behaviour

      // Set a nice background color on its parent
      $(this.parentNode).setCss({ background: '#ffffe1' });

And here’s using the packager from the command line to generate a minified library file of the μtil core and some plugins:

$./bin/mutil hover classes

This will generate a mutil.min.js file that includes the core library and the hover and classes plugins. Easy!


Writing a little library is great fun, as you get to explore practical needs, writing documentation, code optimization and crazy JavaScript quirks. I’ve learned a lot from writing μtil, and even if I will never use it in a production environment it was time well spent.

Dive in

You can find the code for μtil at github, along with documentation and an issue tracker. Please do fork and hack away!

Arjan van der Gaag

Arjan van der Gaag

A thirtysomething software developer, historian and all-round geek. This is his blog about Ruby, Rails, Javascript, Git, CSS, software and the web. Back to all talks and articles?


You cannot leave comments on my site, but you can always tweet questions or comments at me: @avdgaag.