Visual Builder Grunt Tasks

The build tasks exposed by the grunt-vb-build package have options and pre- and post- task hooks that you use when defining the task.

About Visual Builder Grunt Build Tasks

You use pre-defined Grunt tasks and options to define the tasks that are performed when building your application.

The public Grunt tasks that are used to build the application are exposed by the grunt-vb-build package. Some tasks have pre- and post- task hooks which you can use to add custom functionality.

Options that you specify for a task might be overridden by other options that have a higher priority. Task options have the following priority:

  1. Command line options
  2. Task:target specific options (for multitasks)
  3. Task specific options
  4. Generic "vb" options

vb-build

The main task that does a full application build, including deployment.

The following table describes the subtasks, hooks and inputs and outputs of the vb-build task.

Detail Description
subtasks vb-clean, vb-process, vb-optimize, vb-stage
hooks vb-pre-build, vb-post-build
input n/a
output build/to-be-processed.zip, build/processed/*, build/processed.zip, build/optimized/*, build/optimized.zip

The following table describes the options for the vb-build task.

Name Mandatory Default Value Description
Application selection options
id yes n/a ID of visual application you're going to build. The application needs to exist on the referred Visual Builder instance.
ver yes n/a Version of the visual application.
url yes n/a Your Visual Builder instance URL
Authentication options
username no n/a The username to be used to obtain OAuth access token for further communication with Visual Builder services.
password no n/a The password to be used to obtain OAuth access token for further communication with Visual Builder services.
accessToken no n/a The value of OAuth access token. If provided, username and password options are necessary.
Build options
build no build Name of the build directory.
gitSources no ./ Location of the sources of the visual application.

vb-clean

This task cleans the build directory.

The following table describes the subtasks, hooks and inputs and outputs of the vb-clean task.

Detail Description
subtasks n/a
hooks vb-pre-clean, vb-post-clean
input build/*
output n/a

The following table describes the options for the vb-clean task.

Name Mandatory Default Value Description
Build options
build no build Name of build directory.

vb-process

This task processes the local application sources by sending them to the Visual Builder instance.

The processing operation resolves various templates and further modifies (adds and updates) several application resources. The task makes a ZIP archive of the local application sources, sends the archive to the Visual Builder processing service and obtains an archive of processed sources. This archive is then expanded on the local filesystem and used for other tasks.

To run this task you must provide the Visual Builder URL and your credentials for accessing the Visual Builder instance. You can provide the credentials directly when you run the task. Alternatively, you can use the accessToken option to specify a valid OAuth access token.

The following table describes the subtasks, hooks and inputs and outputs of the vb-process task.

Detail Description
subtasks n/a
hooks n/a
input ${gitSources}
output build/to-be-processed.zip, build/processed/*, build/processed.zip

The following table describes the options for the vb-process task.

Name Mandatory Default Value Description
Application selection options
id yes n/a ID of visual application you're going to build. The application needs to exist on the referred Visual Builder instance.
ver yes n/a Version of the visual application.
url yes n/a Your Visual Builder instance URL
Authentication options
username no n/a The username to be used to obtain OAuth access token for further communication with Visual Builder services.
password no n/a The password to be used to obtain OAuth access token for further communication with Visual Builder services.
accessToken no n/a The value of an OAuth access token. If provided, username and password options are necessary.
Build options
build no build Name of build directory.
gitSources no ./ The location of the sources of the visual application.

vb-stage

This task stages (deploys) the visual application artifact to the Visual Builder instance.

The following table describes the subtasks, hooks and inputs and outputs of the vb-stage task.

Detail Description
subtasks n/a
hooks vb-pre-stage, vb-post-stage
input build/optimized/*
output build/optimized.zip

The following table describes the options for the vb-stage task.

Name Mandatory Default Value Description
Application selection options
id yes n/a ID of visual application you're going to build. The application needs to exist on the referred VB instance.
ver yes n/a Version of the visual application.
url yes n/a Your Visual Builder instance URL
Authentication options
username no n/a The username to be used to obtain OAuth access token for further communication with Visual Builder services
password no n/a The password to be used to obtain OAuth access token for further communication with Visual Builder services.
accessToken no n/a The value of an OAuth access token. If provided, username and password options are necessary.
Build options
build no build Name of build directory.
Data processing options
schema no new Specifies data schema processing during application stage or publish. The value can be new, dev, stage or live.

vb-publish

This task publishes a previously staged application to Live mode.

The following table describes the subtasks, hooks and inputs and outputs of the vb-publish task.

Detail Description
subtasks n/a
hooks n/a
input n/a
output n/a

The following table describes the options for the vb-publish task.

Name Mandatory Default Value Description
Application selection options
id yes n/a ID of visual application you're going to build. The application needs to exist on the referred Visual Builder instance.
ver yes n/a Version of the visual application.
url yes n/a Your Visual Builder instance URL
Authentication options
username no n/a The username to be used to obtain OAuth access token for further communication with Visual Builder services.
password no n/a The password to be used to obtain OAuth access token for further communication with Visual Builder services.
accessToken no n/a The value of OAuth access token. If provided, username and password options are necessary.
Data processing options
schema no new Specifies data schema processing during application stage or publish. The value can be new, dev, stage or live.

vb-optimize

This task optimizes the application sources by doing the following: minifies images and CSS, and creates minified requirejs module bundles.

The following table describes the subtasks, hooks and inputs and outputs of the vb-optimize task.

Detail Description
subtasks vb-prepare, vb-image-minify, vb-css-minify, vb-require-bundle
hooks vb-pre-optimize, vb-post-optimize
input build/processed/*
output build/optimized/*

The following table describes the options for the vb-optimize task.

Name Mandatory Default Value Description
Build options
build no build Name of build directory.
Optimization options
emptyPaths no n/a Comma-separated list of require paths that are set "empty". Requirejs optimizer will not follow and bundle matching dependencies.
optimize no uglify2 Type of the requirejs optimization. The value is passed further to requirejs optimizer. Meaningful values are none, uglify or uglify2.
requirePaths no n/a

Requirejs optimizer paths mapping. This will override any default values or values read from app-flow.json

The value needs to be in a form of quoted JSON object: (--requirePaths='{ "foo": "boo" }')

include no n/a Comma-separated list of regular expressions that specify what resources are supposed to be added to the optimization requirejs resources bundle.
exclude no n/a Comma-separated list of regular expressions that specify what ought NOT to be added to the optimization requirejs resources bundle. A resource will not be added if it is both excluded and included.

vb-require-bundle

This tasks creates minified requirejs module bundles.

The following table describes the subtasks, hooks and inputs and outputs of the vb-require-bundle task.

Detail Description
subtasks n/a
hooks n/a
input build/processed/*
output build/optimized/*

The following table describes the options for the vb-require-bundle task.

Name Mandatory Default Value Description
Build options
build no build Name of build directory.
Optimization options
emptyPaths no n/a Comma-separated list of require paths that are set "empty". Requirejs optimizer will not follow and bundle matching dependencies.
optimize no uglify2 Type of the requirejs optimization. The value is passed further to requirejs optimizer. Meaningful values are none, uglify or uglify2.
requirePaths no n/a

Requirejs optimizer paths mapping. This will override any default values or values read from app-flow.json

The value needs to be in a form of quoted JSON object: (--requirePaths='{ "foo": "boo" }')

include no n/a Comma-separated list of regular expressions that specify what resources are supposed to be added to the optimization requirejs resources bundle.
exclude no n/a Comma-separated list of regular expressions that specify what ought NOT to be added to the optimization requirejs resources bundle. A resource will not be added if it is both excluded and included.

vb-css-minify

This task minifies the CSS resources.

The following table describes the subtasks, hooks and inputs and outputs of the vb-css-minify task.

Detail Description
subtasks n/a
hooks n/a
input build/processed/*
output build/optimized/*

The following table describes the options for the vb-css-minify task.

Name Mandatory Default Value Description
build no build Name of build directory.

vb-image-minify

This task minifies the image resources.

The following table describes the subtasks, hooks and inputs and outputs of the vb-image-minify task.

Detail Description
subtasks n/a
hooks n/a

The following table describes the options for the vb-image-minify task.

Name Mandatory Default Value Description
build no build Name of build directory.

vb-export

This task downloads application sources from the Visual Builder instance and expands the archive on the local filesystem for further processing.

The following table describes the subtasks, hooks and inputs and outputs of the vb-export task.

Detail Description
subtasks n/a
hooks n/a
input build/processed/*
output build/optimized/*

The following table describes the options for the vb-export task.

Name Mandatory Default Value Description
Application selection options
id yes n/a ID of the visual application you're going to build. The application needs to exist on the referred Visual Builder instance.
ver yes n/a Version of the visual application
url yes n/a URL of your Visual Builder instance
Authentication options
username no n/a The username to be used to obtain OAuth access token for further communication with Visual Builder services.
password no n/a The password to be used to obtain OAuth access token for further communication with Visual Builder services.
accessToken no n/a The value of an OAuth access token. If provided, username and password options are necessary.
Build options
gitSources no ./ The location of the sources of the visual application.