An Intro To Anvil.js

On November 29, 2011, in Projects, by Alex

Pain is Opportunity

When I first decided to dive into a few Node.js and JavaScript projects, I was frustrated by how little guidance and convention I found in structuring, building and testing these kinds of projects. A lot of what I found seemed like lots of copy and paste solutions that would require several minutes of tweaking between projects. While I did stumble upon Require.js and Ender, neither of these addressed all the things I was concerned about and both were very prescriptive and really only handled one type of solution.

First Big CoffeeScript Project

So I set out to write a tool that would

  • Generate a project scaffold
  • Combine .js and/or .coffee files into build output in a predictable way
  • Run lint against the output scripts
  • Uglify each output script
  • Gzip each output script
  • Be capable of producing different outputs based on different build configurations
  • Generate HTML scaffold for integration tests
  • Host some form of test runner
  • Continuously “build” in the background on file changes

As of several minor versions ago, Anvil is self-built and comes with a few additional features not listed. I’ve found that I can spin up projects very quickly and have running tests in no-time.

Screen Cast

Rather than make you read how easy it is to get started with Anvil, I thought it might be nice to do a screen cast and **show** you how simple it is.

An Intro To Anvil.js from Alex Robson on Vimeo.

Hope you enjoy!

Tagged with:  
  • http://ifandelse.com Jim Cowart

    I think this approach to ‘building’ js and coffee projects is super flexible and powerful. Prior to anvil I was typically writing a batch-file-for-windows or bash-script-for-*nix approach that combined and uglified and while it worked, it was brittle and definitely not extensible. Every time I start a new js project now, I’m relieved that anvil takes care of so much of the overhead I used to be burdened with…awesome stuff, man!

  • Anonymous

    Wow … just wow.

  • http://profiles.google.com/rniemeyer Ryan Niemeyer

    Just watched the video. Very interesting tool. Nice work! You should maybe add a link to the project on this post (unless I missed it). It isn’t the first result in a Google search for anvil.js…at least yet.