In my earlier post, we learned about getting started with taco-cli and also about using one of the most powerful features taco remote + remotebuild. In this, we will see the many different options of bootstrapping/creating a new cordova application using taco-cli.

The very easiest and straightforward option to create a new cordova app is to let the CLI decide which template to use to bootstrap your application. This is the default behavior of the cli when no other options are specified.


taco create myTacoApp

There are more better and useful ways of creating cordova apps using taco-cli. Below are those options

  1. Create a cordova app using a template available in github
  2. Create a cordova app using the assets from an existing web application/ hybrid application
  3. Create a cordova app by linking to the existing assets from a website or hybrid app

Using Templates from github

Let’s say you want to create your application using some of your own existing web site repo/any other open source website/hybrid app repo (say ionic templates),  that can be achieved by using the switch “–template


taco create myGitBasedApp com.demo.myGitBasedApp myGitBasedApp <strong>--template https://github.com/bdotnet/bdotnet-gruntjs-demo</strong><strong>.git</strong>

The output will look like below:

C:\Projects\SampleProjects\TacoSamples>taco create myGitBasedApp com.demo.myGitBasedApp myGitBasedApp –template https://github.com/bdotnet/bdotnet-gruntjs-demo.git
———————————————————————–
Name …………. myGitBasedApp
ID …………… com.demo.myGitBasedApp
Location ………
C:\Projects\SampleProjects\TacoSamples\myGitBasedApp
Kit ………….. tacokit@3.0.0 (Default)
———————————————————————–
========================================================================
Acquiring template from git…

Cloning into ‘C:\Users\Z066157\AppData\Local\Temp\taco_template_4e4484929ae14c49
40f224a2e716cec2d28df460’…
remote: Counting objects: 332, done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 332 (delta 232), reused 324 (delta 232), pack-reused 0
Receiving objects: 100% (332/332), 830.33 KiB | 338.00 KiB/s, done.
Resolving deltas: 100% (232/232), done.
Checking connectivity… done.
========================================================================
Creating a new cordova project.

Success! Your project using the custom git template is ready for use at C:\Projects\SampleProjects\TacoSamples\myGitBasedApp

Using assets from existing website/hybrid app

Let’s say you have an existing website/mobile app’s assets in a file system which you want to reuse in your new hybrid app, or as an enterprise mobile app developer you want to create a consistent experience across all your apps by reusing the assets from other applications. In such cases, we can leverage taco-cli to create our new apps by using the switch “–copy-from <your assets folder>”


taco create bdotnet-taco-app com.demo.bdotnetTacoApp bdotnetTacoApp --copy-from "C:\Github\bdotnet-gruntjs-demo\app"

In the previous example, I have asked taco-cli to create a new app using the assets from my existing web application to provide a consistent experience. The output of this will look like below

C:\Projects\SampleProjects\TacoSamples>taco create bdotnet-taco-demo-app com.demo.bdotnetTacoApp bdotnetTacoApp –copy-from “C:\Github\bdotnet-gruntjs-demo\app”

————————————————————————–
—–
Name …………. bdotnetTacoApp
ID …………… com.demo.bdotnetTacoApp
Location ………
C:\Projects\SampleProjects\TacoSamples\bdotnet-taco-dem
o-app
Kit ………….. tacokit@3.0.0 (Default)
————————————————————————–
—–
Creating a new cordova project.

Success! Your project using custom assets from C:\Github\bdotnet-gruntjs-demo\app is ready for use at C:\Projects\SampleProjects\TacoSamples\bdotnet-taco-demo-app

Linking assets from existing application

The previous two options hold good in case you had a finished product already and you wish to create a mobile app out of it. But what if, you have an app/website in current development and you want to share the assets with your hybrid app as well in parallel. In such cases, mere copying the assets will create duplicate efforts on every change. To avoid this, we can leverage taco-cli’s link option to create a symlink to the ‘www‘ folder while creating the app, this way as and when any change happens in the source location, the same will be replicated in our app as well. To create using link option , use the switch “–link-to <your assets folder>


taco create myLinkedApp com.demo.myLinkedApp myLinkedApp --link-to "C:\Github\bdotnet-gruntjs-demo\app"

The output will look like below:

C:\Projects\SampleProjects\TacoSamples>taco create myLinkedApp com.demo.myLinkedApp myLinkedApp –link-to “C:\Github\bdotnet-gruntjs-demo\app”
———————————————————————
Name …………. myLinkedApp
ID …………… com.demo.myLinkedApp
Location ………
C:\Projects\SampleProjects\TacoSamples\myLinkedApp
Kit ………….. tacokit@3.0.0 (Default)
———————————————————————
Creating a new cordova project.

Success! Your project using custom assets from C:\Github\bdotnet-gruntjs-demo\app is ready for use at C:\Projects\SampleProjects\TacoSamples\myLinkedApp

Taking a look at the windows explorer about the new project’s folder contents, we could see a linked folder has been created for ‘www’

Taco-SymLink

Once the app is created, further steps remain the same to add a platform, build and emulate/run it.

Advertisements