vb-optimize-cdn

Deploys the app's resources to a Content Delivery Network (CDN) service to improve a web (or mobile) app's loading performance.

Typically, the application's index.html resource that's mapped to the root application URL is deployed to a Visual Builder Runtime service, and the rest of the application's assets is uploaded to CDN. To link application assets deployed to the CDN with the index.html, you need to use a base tag, whose href value determines the root URL that's used to resolve relative references in index.html (scripts/images/styles/modules).

This task inserts this base tag with the href attribute that contains the base URL of the deployed application resources. The URL inserted in the href is taken from the following locations in this order:
  • cdnUrl command-line option
  • cdnUrl setting in the vb-optimize-cdn task's options
  • resolveTemplate.BASE_URL entry from the vb-process-raw-index-html task's options (for Oracle Cloud Applications)

If you don't specify any of these options, the task will silently do nothing.

This task automatically runs from within the vb-optimize task for visual applications. It does not run for Oracle Cloud Application extensions.

Detail Description
subtasks -
multitask (config generator task: vb-optimize-cdn-configuration)
hooks -
input build/optimized/*
output build/optimized/*

The following table describes the options for the vb-optimize-cdn task:

Name Mandatory Default Value Description
cdnUrl n/a n/a URL of the deployed application assets. It's important that the CDN assets URL ends with slash ("https://my.cdn.com/myapp/"), otherwise resources will be resolved against the parent segment URL.
insertBaseUrl n/a false Inserts BASE_URL token to index.html's vbInitConfig section
insertBaseTag n/a true Disables insertion of the base tag for Oracle Cloud Applications that define resolveTemplate.BASE_URL entry in the vb-process-local task's options; in this case, insertion of base tag is automatic.