Optimize a Specific Web Application

You can optimize a specific application by editing Gruntfile.js or your custom Jenkins shell script to specify a target for the build task.

In Gruntfile.js, you can redefine the vb-build task and specify a target for the vb-optimize task. Alternatively, you can create a new task that performs steps similar to the vb-build task and specify the target.

To specify an app as a task target in Gruntfile.js:

  1. Open Gruntfile.js.
  2. Edit the file to define the tasks performed for the vb-build task and specify a target for the vb-optimize task.

    The target name is the path of the web application relative to the /webApps directory.

    module.exports = (grunt) => {
        require('load-grunt-tasks')(grunt);
        grunt.registerTask('vb-build', [
            'vb-pre-build',
            'vb-clean',
            'vb-prepare-sources',
            'vb-optimize:myWebApp',
            'vb-deploy',
            'vb-post-build',
        ]);
    };

You can also define the target in your Jenkins shell script, for example, by modifying it similar to the following:

grunt vb-prepare-sources --url=... --id=... --ver=... --username=... --password...grunt
 vb-optimize:myWebApp
 grunt vb-deploy --url=... --id=... --ver=... --username=... --password...

You can also edit the script to run only specific optimization tasks:

# vb-image-minify-configuration will create configurations of vb-image-minify multitask for
        all existing web application
grunt vb-image-minify-configuration vb-image-minify