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, ...
Get Getting Started with Grunt: The JavaScript Task Runner now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.