Introducing Pint, the new build system for Grunt.js
Ivan: What is Pint?
Eric: Pint is a small, concurrent build system for Grunt.js. The idea behind Pint is that your build is more than just a list of tasks. Pint attempts to create a build system by providing structure, lifecycle and other meta-level tasks to your existing Grunt build.
Eric: Grunt has moved up in the world and we’re starting to see it used on large complex projects. As your build grows, like in any other piece of code, managing complexity becomes one of the hardest part about modifying it. We should be treating our build with the same engineering discipline that we treat other pieces of code with and with Pint I’m trying to nudge things in that direction. By encouraging good organization, building off of existing tooling, and automating build execution order, Pint can greatly reduce the complexity of maintaining your build. One side effect of this is that your team goes from having “the build guy” to sharing ownership of a collection of easy-to-understand files just like everywhere else.
**Ivan: What are Pint’s major features/benefits?**
Eric: There are four main features of Pint:
Concurrency - It’s surprising that after a few years of development, Grunt hasn’t introduced any build dependency management since Ant back in the year 2000 had a depends-on statement. The concept is simple; each Job may depend on something that came before it. For example, copying the minified files to a dist directory would need to happen after all the compilation steps. In Grunt you are left to carefully craft this execution order on a per build basis. Pint solves this with a simple declarative dependsOn array in each Job. Declaring your dependencies lets Pint build an internal dependency model and parallelize your build where possible by spinning up new Grunt processes.
Lifecycle - This is a small but important one. Often in projects you will need to do some tasks that are not strictly related to the build. Pulling the Git SHA or the package.json file into variables for use in cache busting for example. Pint uses a simple build lifecycle with initializer and finalizer tasks that are part of each Job for this purpose.
**Ivan: What inspired you to create Pint?**
Eric: I come from a traditional computer science background and in school they really don’t teach you much about web. Where I went to school, classes were pretty heavy on C/C++ and Java, which is the type of development I ended up doing after graduation. When I moved into the world of front end development I found that the tools I was used to were way behind those in other communities. It’s a really exciting time to be involved with front end since there is so much out there we can learn from other languages.
**Ivan: What other cool projects do you and Formidable Labs have up your sleeve (or out in the open)?**
Eric: The Pint website has some good information and a quick start guide. I have a repo you can pull down and get started with right away, if you want to check out a sample project built with Pint. If you just want to checkout the source, the project is hosted on Github.