|
11 | 11 | <li>a web developer and want to deploy a web app that's packaged for distribution in various app store portals.</li>
|
12 | 12 |
|
13 | 13 | <li>a mobile developer interested in mixing native application components with a WebView (special browser window) that can access device-level APIs, or if you want to develop a plugin interface between native and WebView components.</li>
|
| 14 | + |
| 15 | + |
| 16 | +# Create your first Cordova app |
| 17 | +<p>This guide shows you how to create a JS/HTML Cordova application and deploy them to various native mobile platforms using the cordova command-line interface (CLI). For detailed reference on Cordova command-line, review the CLI reference.</p> |
| 18 | + |
| 19 | +# Installing the Cordova CLI |
| 20 | +<p>The Cordova command-line tool is distributed as an npm package. |
| 21 | + |
| 22 | +To install the cordova command-line tool, follow these steps: |
| 23 | + |
| 24 | +Download and install Node.js. On installation you should be able to invoke node and npm on your command line. |
| 25 | + |
| 26 | +(Optional) Download and install a git client, if you don't already have one. Following installation, you should be able to invoke git on your command line. The CLI uses it to download assets when they are referenced using a url to a git repo. |
| 27 | + |
| 28 | +Install the cordova module using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.</p> |
| 29 | + |
| 30 | +# on OS X and Linux: |
| 31 | +<p> |
| 32 | + $ sudo npm install -g cordova |
| 33 | +On OS X and Linux, prefixing the npm command with sudo may be necessary to install this development utility in otherwise restricted directories such as /usr/local/share. If you are using the optional nvm/nave tool or have write access to the install directory, you may be able to omit the sudo prefix. There are more tips available on using npm without sudo, if you desire to do that.</p> |
| 34 | + |
| 35 | +# on Windows: |
| 36 | + |
| 37 | + C:\>npm install -g cordova |
| 38 | +The -g flag above tells npm to install cordova globally. Otherwise it will be installed in the node_modules subdirectory of the current working directory. |
| 39 | + |
| 40 | +Following installation, you should be able to run cordova on the command line with no arguments and it should print help text. |
| 41 | + |
| 42 | +# Create the App |
| 43 | +Go to the directory where you maintain your source code, and create a cordova project: |
| 44 | + |
| 45 | +$ cordova create hello com.example.hello HelloWorld |
| 46 | +This creates the required directory structure for your cordova app. By default, the cordova create script generates a skeletal web-based application whose home page is the project's www/index.html file. |
0 commit comments