Show TOC

Bootstrapping: Loading and Initializing Locate this document in the navigation structure

To use SAPUI5 features in your HTML page, you have to load and initialize the SAPUI5 library.

You can use the SAPUI5 bootstrap script in your page to initialize SAPUI5 runtime automatically as soon as the script is loaded and executed by the browser. For simple use cases as well as the default SAPUI5 installation, this is sufficient to build and run UIs. In addition to this, you can specify the set of SAPUI5 libraries and the theme used for your application in the configuration settings.

Note

If you run your app standalone, the bootstrap is added to your HTML page. In a SAP Fiori launchpad environment, the launchpad executes the bootstrap and no additional HTML page is needed to display the app.

The following code snippet shows a typical bootstrap script tag:

<script id="sap-ui-bootstrap" 
     type="text/javascript"
     src="resources/sap-ui-core.js"
     data-sap-ui-theme="sap_bluecrystal"
     data-sap-ui-libs="sap.m"
     data-sap-ui-compatVersion="edge">
</script>

The attributes data-sap-ui-theme="sap_bluecrystal" and data-sap-ui-libs="sap.m" already provide examples of how SAPUI5 runtime can be configured to the needs of an application.

Overview of Bootstrap Files

SAPUI5 provides several bootstrap files for different use cases. The following table gives an overview of the most important resources and the respective use cases. The resource names refer to the resources/ folder in the SAPUI5 installation. The actual base URL depends on your platform and administrative setup.

Resource Description
sap-ui-core.js

This is the standard bootstrap file, which we recommend to use for typical use cases. It already contains jQuery, jquery-ui-position and only the minimum required parts of the core library (sap.ui.core). Required files are loaded dynamically using XMLHttpRequest (XHR).

For more information, see Standard Variant for Bootstrapping.

Content Delivery Network (CDN)

You can access the libraries externally from a CDN. For more information see Variant for Bootstrapping from Content Delivery Network.

sap-ui-core-nojQuery.js

You use this bootstrap file for applications with their own jQuery version. It also contains the minimum required parts of the core library, but not jQuery and jquery-ui-position.

For more information, see noJQuery Variant for Bootstrapping.

sap-ui-core-all.js

This bootstrap file contains almost all resources of the sap.ui.core library. Only a few duplicates, such as multiple jQuery versions, testing resources, and so on, are omitted. If you use this file for bootstrapping, the *-all.js file is also loaded for all other libraries. This reduces the number of JavaScript requests to the number of libraries (typically 1..4).

Note To ensure proper encapsulation, the *-all.js files will be renamed in future versions of SAPUI5. The sap-ui-core-all.js file remains as is, but for the files for other libraries a name relative to the library will be used, for example sap/ui/commons/library-all.js. Applications must not address these files directly as SAPUI5 runtime loads them. Only sap-ui-core-all.js can be directly referenced in the bootstrap tag.
Note This function is deprecated.
sap/ui/core/library-preload.js

This bootstrap file is similar to the sap-ui-core-all.js file, but the modules are parsed and executed only on demand, and not immediately.

Caution An application must not reference this file. If the configuration option is set to preload, SAPUI5 automatically loads the file.

For more information, see Preload Variant for Bootstrapping.

sap-ui-core-lean.js

This bootstrap file is similar to the sap-ui-core.js file, but in this use case only the jQuery and one SAPUI5 file are loaded immediately and the other files are loaded dynamically.

Caution

This use case is usually not used and may be removed in future.

sap-ui5.js

This bootstrap file contains all JavaScript modules from the sap.ui.core, sap.ui.commons, sap.ui.table and sap.ui.ux3 libraries. If you use this file for bootstrapping, you only need one single request, but the loading time may be longer as the loading time for other use cases. Another drawback of this use case is the fixed set of libraries.

This file is only available on platforms based on the sapui5.war or sapui5-static.zip artifacts. The OSGi/Eclipse versions (com.sap.ui5.core.jar), for example, do not contain this file.

For more information, see sap-ui5 Variant for Bootstrapping.

sap-ui-custom*.js

This bootstrap file is reserved for custom merged files created by the application.

Note The proposed naming scheme for these files needs to be adapted in future versions for the same encapsulation reasons as mentioned above.