O'Reilly logo

Getting Started with Grunt: The JavaScript Task Runner by Jaime Pillora

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

External tasks

In many instances, our Gruntfile.js file can become quite large and complicated, especially when we start including our own custom tasks into the mix. Grunt provides the means to split our custom tasks into their own individual files, thereby reducing the complexity of our Gruntfile.js and increasing reusability, since this new task file could also be used in other Grunt projects. In Chapter 3, Using Grunt, we learnt how to use grunt.registerTask to create our own custom tasks; however, to move these calls to registerTask into another file, we will need a reference to the grunt object (since grunt is passed into our Gruntfile.js).

This is exactly what the grunt.loadTasks function does: it is called with a directory path as the argument, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required