Java Reference
In-Depth Information
Task Runners
A
task runner
is a piece of software that automates tasks that can be tiresome to carry out
by hand. These include the following tasks:
• minifying code
• linting
• testing code
• compiling modules into a single file
• compiling CSS preprocessor files (such as Sass, Less, or Stylus) into standard CSS
files
Grunt
Probably the most popular task runner at the time of writing is
Grunt.
It can be used for a
variety of tasks and has a plugin system, so many common tasks are already available to use
as plugins. Grunt needs Node.js to run and is installed using npm with this line of code:
npm install grunt -g
Note that the
-g
flag is used to install Grunt globally, makings it available in all projects on
your system. It can be run using
grunt
rather than
node grunt
.
npm will also require a package.json file. This is a configuration file that lists all the npm
packages required to run the task, including Grunt itself. A basic package.json file can be
created using the
npm init
command. Here is an example of a package.json file:
{
"name": "ninja project",
"version": "1.0.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.5.0"
