Accelerate your UI5 application with component-preload minified
Hi,
After working on a project where the connectivity of the pc was not desirable, we came to the conclusion that we needed something more than the component-preload to minimize the load of the application.
In this sense, we decided to minimize the size of the code to load, we conclude that we should generate files with GULP through the minification.
You can generate the component-preloadjs file by following these steps:
https://github.com/enric11/OpenUI5compiler
We added here the steps that we can find also in the github wiki:
Install
- Install the last version of node.js node.js
- Download files package.json and gulpfile.js Master branch
- Copy this files into your project into WebContent folder
- Configure eclipse to discard node packages when sumbit files to SAP Gateway in “Windows” > “References” > “Team” > “Ignored Resources” and add “node_modules”
- Install gulp dependencies with package.json
- Prepare gulpfile.js for your project. You need to change name of project in gulpfile with your name of project in index.html:
After these stepts you will have a new folder called node_modules, so, the project are ready to generate component-preload.js.
2. Generate Component preload.js
To generate component-preload.js file with task minify js, you only have to execute the task of gulp with the right button of your mouse.
A few seconds later we have our file 🙂
And we already have our application minimized 😉
For more information *https://www.npmjs.com/package/gulp-minify
Sounds great! So how can I make a preload file for my UI5 app?
You only need this tutorial
Great tutorial! Thanks.
Hello Enric Castella Gonzalez
I got error when running step 5 - Install gulp dependencies with package.json
17447 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
17448 error node v6.9.3
17449 error npm v3.10.10
17450 error code ENOGIT
17451 error not found: git
17452 error Failed using git.
17452 error This is most likely not a problem with npm itself.
17452 error Please check if you have git installed and in your PATH.
17453 verbose exit [ 1, true ]
Does this mean I have to install GIT?
Thank you.
Tri
If you use Windows is not necessary install git. But some times you need to configure git path.
Please check the solution mentioned in the follow post:
https://stackoverflow.com/questions/26620312/installing-git-in-path-with-github-client-for-windows
Best regards
Struck in
2. Generate Component preload.js
Found this error in console:
/bin/bash: line 1: gulp: command not found
Hope someone helps.
Hi!
It is possible that you run command as administrator.
Check this link https://stackoverflow.com/questions/40390887/gulp-command-not-found
Hi Enric,
are you aware of the SAP supported build using Grunt? https://www.sap.com/developer/tutorials/webide-grunt-basic.html
Best regards
Gregor
Thanks for the input!
It is very interesting to know that it is possible to use Grunt with IDE web.
In our case, we work with Gulp because we use it in other developments.
good