red line

Using Grunt and Jade to Tame XML Configuration Files

Our SOLID engineers use build automation combined with templating to ensure error free management of configuration files.

A mis-typed value in a configuration file can do anything from taking your entire site down to exposing private user data to the public. Our SOLID engineers use build automation combined with templating to ensure error free management of configuration files. Our preferred tools are Grunt and Jade.

Grunt is a task-based command line build tool for all types of projects. The Grunt home page claims it is for Javascript projects, but our engineers at SOLID have used Grunt for Java, Objective-C, PHP, and yes, even Javascript projects. Grunt allows the management of the templating and other tasks during a build. It enables us to do general clean up after a build (deletion of xml schemas and other sensitive files), version control management, and everything else our devs have been able to think of so far.

Jade is a templating engine that was created for HTML, and so can be used for XML as well. Templating engines can make config files more readable and reusable. Additionally, using automation to keep configuration files updated reduces the chance that developers forget to update something or make a costly typo. Templating allows conditional inclusion of chunks of XML in a config file. For example, logs in Propel can be turned on or off for stage and live environments. Additionally, things like passwords for different environments may be set based off of the build environment.

Together, Jade and Grunt allow us to automate builds and provide cleaner and clearer code. Once a build task is created, SOLID engineers do not have to worry about whether they forgot to edit, add, or delete files, directories, or variables. Build automation enables better technical development, team utilization, and issue resolution to our clients.

Related resources