UNPKG

1.73 kBMarkdownView Raw
1# gulp ui5 eager preload plugin
2
3[![npm version](https://badge.fury.io/js/gulp-ui5-eager-preload.svg)](https://www.npmjs.com/package/gulp-ui5-eager-preload)
4
5Please use this module by [The ultimate generator for UI5](https://github.com/ui5-next/ui5g)
6
7## features
8
9* preload standard modules (with `uglify`, only preload used modules).
10* allow manually maintain resources & module.
11* generate `index.html`, inline `library.css` avoid xhr block request.
12* local file & url based cache.
13* enable use thirdparty library from `node_modules`
14
15in standard `openui5 workthrough` demo
16
17* totally downloaded file size will reduce `%50` or more (depends on the usage rate for single standard library).
18* first screen time dropped from 1500ms to 300ms (with cache).
19* reduce the number of requests.
20
21## sample configuration
22
23```js
24
25eagerPreload({
26 // Current Project Title
27 title: "UI5 Project",
28 // theme
29 theme: "sap_belize",
30 // standard library resource root
31 ui5ResourceRoot: "https://openui5.hana.ondemand.com/resources",
32 // enable preload logic
33 preload: true,
34 // offline mode, will not load resource from ui5 resource root directly
35 offline: true,
36 sourceDir: join(__dirname, "./src"),
37 // thirdparty library output library
38 thirdpartyLibPath: "_thirdparty",
39 // project namespace
40 projectNameSpace: namespace,
41 // additionalResources
42 additionalResources: [
43 "sap/m/messagebundle_zh_CN.properties",
44 "sap/ui/core/messagebundle_zh_CN.properties"
45 ],
46 // boot script
47 bootScriptPath: "./index.js",
48 // additionalModules
49 // sometimes ui5 will dynamic load resource
50 // just use devtools find them and add them to here
51 additionalModules: ["sap/m/routing/Router", "sap/ui/thirdparty/datajs"]
52})
53
54```