Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
1st checkin for browser docs additions.
Browse files Browse the repository at this point in the history
  • Loading branch information
hollyschinsky committed Apr 1, 2016
1 parent 7c12e2a commit ff4b759
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
29 changes: 27 additions & 2 deletions docs/1-getting-started/4-preview-your-app/2-cli.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 11,37 @@ tabs:
next: 1-getting-started/5-going-further.html.md
---

The PhoneGap CLI has a `serve` command for starting a small web server to host your project to be consumed by the PhoneGap Developer App or any browser.

You can use the **PhoneGap Developer App** paired with the **PhoneGap CLI** to immediately preview your app on a device without installing platform SDKs, registering devices, or compiling code.

The PhoneGap CLI starts a small web server to host your project and returns the server address for you to use from the PhoneGap Developer App running on your mobile device.
### Preview in a Desktop Browser
You can preview and test out your apps in your desktop browser first to get started most quickly. PhoneGap will default to supporting
the browser when you invoke the `serve` command. The browser platform will automatically be added in this case and you'll be able to
test your app with the `deviceready` event fired and support for the core plugins. In many cases the data you receive from the core
plugins will simply be mock data or just handle any errors that would otherwise be thrown, but you can still get your development
started quickly with this option and flesh out bugs quickly with your favorite debugging tools. For instance, if you're using a framework
like AngularJS or React, there are several Chrome plugins to help you debug more easily before you move to your device. Once you are

To preview your app in the browser, following these steps:

1. `cd` into the project created in the step 3 (or any PhoneGap project root)

2. Serve it using the CLI `serve` command:

`$ phonegap serve`

3. Open your browser to the IP address the app was served on. You can find it in the console output of the `serve` command.

4. You can now use your favorite browser debugging tools to help you develop quickly.

![](/images/browser-debug.png)

<div class="alert--tip">You can specifically disable browser support using the `--no-browser` option with the `serve` command.</div>

### Preview on a Device
You can use the **PhoneGap Developer App** paired with the **PhoneGap CLI** to immediately preview your app on a device without installing platform SDKs, registering devices, or compiling code.
The PhoneGap CLI starts a small web server to host your project and returns the server address for you to pair with from the PhoneGap Developer App running on your mobile device.

<div class="alert--warning">Double check to ensure you're running your device and computer on the same network before continuing. </div>

1. `cd` into the project directory created in the previous step and type `$ phonegap serve`. You will receive the server address the app is being hosted on in the output received in the console (`192.168.1.11:3000` in this example):
Expand Down
18 changes: 18 additions & 0 deletions docs/3-references/browser-support/browser-support-guide.html.md
Original file line number Diff line number Diff line change
@@ -0,0 1,18 @@
---
title: PhoneGap Desktop Browser Support
url: references/desktop-app/install/mac
github_url: https://github.com/phonegap/phonegap-docs/blob/master/docs/3-references/browser-support-guide.html.md
layout: subpage
expand: desktop
---

### Overview

One of the biggest benefits of hybrid app development is the ability to develop a large pat of your app without ever
leaving your desktop. You can leverage your desktop browser and the built-in tooling to test your apps until you specifically
need to access specific device features. You can even ensure your components are laid out properly using the Chrome Deeloper tools
built-in [mobile device emulator](https://developers.google.com/web/tools/chrome-devtools/iterate/device-mode/).

### Plugins
All of the core Cordova plugins also include desktop browser support so you can still continue your testing in the browser. Some
will return mock data and some will simply err silently so you can continue along with your other testing.
4 changes: 4 additions & 0 deletions docs/3-references/phonegap-cli/serve.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 22,8 @@ phonegap serve [options]
--port, -p <n> port for web server (default: 3000)
--autoreload enable app refresh on file changes (default: true)
--no-autoreload disable app refresh on file changes
--browser enable desktop browser support (default: true)
--no-browser disable desktop browser support
--localtunnel enable a local tunnel for public access (default: false)
```

Expand All @@ -35,6 37,8 @@ $ phonegap app
$ phonegap serve
$ phonegap serve --port 1337
$ phonegap serve --no-autoreload
$ phonegap serve --browser
$ phonegap serve --no-browser
$ phonegap serve --localtunnel
$ phonegap app
```
1 change: 1 addition & 0 deletions layouts/includes/sidebar.jade
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 18,5 @@ aside.sidebar
li: a(href="/references/desktop-app" class=document.url === 'references/desktop-app'? "current" : "") PhoneGap Desktop
li: a(href="/references/developer-app" class=document.url === 'references/developer-app' ? "current" : "") PhoneGap Developer
li: a(href="/references/phonegap-cli" class=document.url === 'references/phonegap-cli' ? "current" : "") PhoneGap CLI
li: a(href="/references/browser-support-guide" class=document.url === 'references/browser-support-guide'? "current" : "") PhoneGap Browser Support
li: a(href="/plugin-apis" class=document.url === 'plugin-apis'? "current" : "") Plugin APIs
Binary file added public/images/browser-debug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff4b759

Please sign in to comment.