In Javascript development the code that you write is never quite the code that you want in production.

The code you want to write has jsDoc, meaningful and by extension long variable names and white space to make it a delight to read just to name a few.

The issue is that these things that make it easy for the code to be read and makes it larger and longer for a browser to download it, leading to slower code.

What we need to do is to have a build and deploy process, ideal one that integrates with our source control. Graham Robinson has explored some of these ideas in his blog, SAPUI5-Deployer Project. I had a couple of key conversations with Graham as he was putting this together.

Recently when I arrived on another client I realised that our needs were similar but different.

  • We still need to get the code from the developer machine to gateway system efficiently.
  • We need to minify the code to reduce load times
  • We would like to have -dbg versions of the code so that we can toggle the debug mode in QA or Production systems.
  • We would like to add a component-preload.js file as described by Mattius in Optimizing UI5 Apps
  • I would like to make the command line build process as simple as possible.

In our situation our source code control is inside the firewall all this process needs to happen inside the firewall also.

There is too much here to cover in one blog so I am going to make this a series of blogs so that you can easily digest this.

Before we get to the next piece of the puzzle, let me introduce Grunt.

Grunt is a task runner. There is nothing new in this make, maven and ant are all examples of great task runners and they are all great tools.

I settled on grunt as it was tools that the UI5 team had also chosen. If you  have a local clone of UI5, you will see how grunt is used to build UI5 itself.

The other great thing about Grunt that it is javascript based and runs on nodejs. All these skills are excellent to have as you develop as a UI5 developer.

In the next blog we will install node install grunt and get our first task running.

|– Previous blog You are at the beginning!  Next blog: Solutions and Scenarios –>

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Robin van het Hof

    Grunt is an unavoidable tool in my workflow, simply because of the automations you could build (think of continuous integration / continuous delivery with Jenkins, automated testing of your code, minifying/uglifying, running a watch task so you can test locally without even deploying)

    One day I hope grunt capabilities will make it into SAP Web IDE — the fact it is not yet possible is a real drawback for me

    (0) 
  2. Shrutika Purohit

    For now Sapui5 will survive. For the next 2 years, if you are aware of sapui5, this will be awesome. This is because not many people know this technology. And even if they know, they still dont know the best possible way of developing an application. So after they finish developing 70% of an application, the rest 30% seems to be undoable. That’s because the base of the application was not correctly done.

    (0) 

Leave a Reply