HTML and CSS Reference
Automating Your Workflow with
Node.js and Grunt
Jesse Freeman, Developer Evangelist, Amazon
Insanity: doing the same thing over and over again and expecting different results.
As developers, we tend to do a lot of repetitive tasks. We are constantly compiling code, packaging it, and deploying it
to different places. As the project scales, the complexity of these processes continues to grow. If there is one constant
among humans, it's that we are not great at doing repetitive tasks, especially complex ones. Sure, we can do one single
task over and over again, but anything more complicated, and the system quickly breaks down. This isn't anything
new; Henry Ford realized it when he took advantage of the assembly line to lower the cost of making cars. We can do
the same thing for our own code by taking advantage of automation.
Automating Your Workflow
If you come from working with other programming languages, such as Java or ActionScript, the idea of automation
may not be alien to you. When compiled, these languages rely on Java, and, as such, it is easy to integrate them into
developers, we can take advantage of Node.js to handle the running of all our automation scripts. Node.js is
incredibly powerful, and, when paired with a build system, such as Grunt, , we can attain results similar to those other
Java, and, in order to package it, you simply upload it to the server. However, if you have tried to support multiple
platforms before, or looked for ways to compress and optimize your code, you know that there is more involved than
just sending your code up to a server via file transfer protocol (FTP) to get it running. Let's take a look at some of the
unique advantages to automating your workflow, which will be the focus of this chapter.
Optimize and package your game : Games are the biggest abusers of resources when
running. Games usually have thousands of lines of code, hundreds of assets, and lots of
additional files that need to be loaded at runtime. You can minimize and compress your
game's code to shrink its size and combine the requested files to cut down on load time.
Deploy to multiple platforms : HTML5 games live in more than one place nowadays. You
may want to publish the game to your server, submit it to a Web store, or put it in a wrapper
to run natively.