msc mobile emerging technologies blog

How To Automate the "Cordova prepare" Command

Posted by Alexander Ilg on May 27, 2018 2:27:12 PM

The SAM Smart Asset Management client is based on the Apache Cordova framework and SAP UI5. This ensures that the application is platform independent and runs on iOS, Android and Windows.

When you are familiar with Cordova you know that you need to run a cordova prepare statement every time you change one of the files in the www folder and you want to test it.

The following short tutorial shows how you can automate this processes so that it happens without interaction in the background

Do the following:

  1. Make sure that ruby and gem are installed (should be by default on the Mac)
  2. Install a tool called filewatcher. To do this run the following command in the terminal: [sudo] gem install filewatcher - you can find more information about filewatcher here:
  3. In your cordova projects root directory run the following command: filewatcher 'www/**/*.*' 'cordova prepare ios' - now whenever you change a file in the www folder, cordova prepare is executed.
Apache Cordova


This is an easy way to speed up the development of the web based Cordova client application.


Topics: Cordova, SAM