Overview

You can use Grunt to build your application from the sources stored in your Git repository or stored locally. Your visual application includes a Grunt file that you modify to define custom tasks that you want to include in the build process and to configure built-in tasks.

The root folder of your visual application includes two resource files that Grunt uses when building applications:

File Description
Gruntfile.js Contains a basic Grunt script for building the app that can be modified to add custom build tasks, and to configure built-in tasks.
package.json Declares the dependency and specifies the URL reference to the grunt-vb-build NPM package that provides the Grunt tasks used to build and audit visual applications. Visual Builder automatically updates the package version and URL whenever Oracle publishes a new version of the package.
The build process for an application using Grunt includes the following steps:
Step Description
Process the application sources

This step consists of several important processes. The most important is "metadata processing", when the visual application sources are transformed into a deployable form. This includes the injection of Visual Builder runtime links and other configuration into the application's index.html, processing other application templates, the creation of service definition files, and so on.

You run the vb-process-local task to process application sources. This task creates an output directory (./build/processed) with built assets that can be consumed by the vb-package and vb-deploy tasks.

Optimize the processed sources

This step consists of a number of parts: optimize images, optimize styles, create require module bundles, and, if necessary, deploy the app's resources to a content delivery network.

To optimize the processed sources, you run either the vb-optimize task on its own, or you run the vb-package task (which includes the vb-optimize and vb-manifest tasks by default).

The vb-optimize task runs the vb-css-minify, vb-require-bundle, and vb-optimize-cdn tasks, and generates the ./build/optimized directory with the optimized sources.

Deploy the application artifact

This step consists of creating the deployment package archive and deploying it to the Visual Builder instance. You run the vb-deploy task to deploy the application artifact.

You can include custom tasks in any of the steps by modifying Gruntfile.js to redefine tasks.