Add Custom Functionality to Existing Tasks
The public tasks exposed by the grunt-vb-build package have pre- and post- task hooks that you can redefine to add custom functionality.
For example, you can define hook tasks in Gruntfile.js to add some special application processing before the optimization step (vb-pre-optimize) by performing the following steps:
-
Open
Gruntfile.js. -
Edit the file to define the hook tasks.
To define the hook tasks
vb-pre-optimize, your edited Gruntfile.js might be similar to the following:module.exports = (grunt) => { require('load-grunt-tasks')(grunt); grunt.registerTask('vb-pre-optimize', () => { // add custom resources or modify existing resources here }); };