Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Grunt 0.4.0 Released: An Emphasis On Modularity

Grunt 0.4.0 Released: An Emphasis On Modularity

This item in japanese

The Grunt team updated their Javascript task runner to version 0.4.0 on February 18th in their ongoing effort to decouple the library into more modular parts.

Tyler Kellen, one of Grunt’s core team members, hopes that by "tearing grunt apart" in 0.4.0, they’ve laid the framework for an extensible and maintainable solution in the long term. By folding both the built-in tasks as well as the grunt command line tool into the package.json file as project dependencies, the team hopes to gain tighter focus across the entire ecosystem -- from its core to its plugin repository. "We’re focusing on modularizing Grunt as much as possible," says Kellen. "We’ve built a lot of powerful utilities -- now that they’ve been proven in the real world, we’re working on breaking some of them into micro libraries."

The trend of parlaying the codebase into discrete, micro bits fits well with the team’s emphasis on the Unix philosophy, an effort manifested in variant forms:

  • Chaining tasks. "Grunt makes it easy to create ‘alias’ tasks to execute an arbitrarily assigned number of ‘normal’ tasks," says Kellen.
  • A growing plugin repository. Among the hundreds available, "Jon Schlinkert is working a Jekyll-like static site generator [called assemble] using Grunt. It’s pretty ambitions for a plugin!" says Kellen.
  • Lower barrier to entry. Because the tasks are chainable and adhere to a common api, "Grunt has dramatically lowered the barrier of entry by providing a common interface to linting, concatenation, minification, testing, versioning, etc," says Kellen.

Born out of frustration with the disparate tools available to developers, Kellen says that Ben Alman -- Grunt’s creator -- conceived of Grunt in March of 2012 as a cohesive alternative. "Apparently the developer community agreed," says Kellen. "We’re seeing over 60,000+ downloads of Grunt every month and the number is steadily growing."

These developers include "jQuery, [which is] probably the biggest. Google is using it heavily for Yeoman and AngularJS. Adobe and Twitter are using it for some projects, and LESS is in the process of migrating to Grunt too," says Kellen.

Notable among Grunt use cases is testing. Although the Grunt team hasn’t built any "direct collaboration with any CI providers, Grunt will exit with the correct codes if you use it to run your test-suite and it fails. We’re using TravisCI to run nodeunit tests with Grunt for 40+ repos, including the entire grunt-contrib series of plugins and their associated libraries," Kellen says.

As Grunt matures, it will continue to be modularized, says Kellen, "We will be extracting our file-globbing system into a standalone npm package. We’re also working on a major architectural update to Grunt’s plugin format, called node-task."

Rate this Article