You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Ionic Framework command line utility makes it easy to start, build, run, and emulate [Ionic](http://ionicframework.com/) apps. In addition, it comes with (optional!) integration with the [Ionic Cloud](http://ionic.io/), a set of mobile backend services perfect for Ionic apps.
7
+
The Ionic Framework command line utility makes it easy to start, build, run, and emulate [Ionic](http://ionicframework.com/) apps. In addition, it comes with (optional!) integration with the [Ionic Cloud](http://ionic.io/), a set of mobile backend services perfect for Ionic apps.
9
8
10
9
Use the `ionic --help` command for more detailed task information.
11
10
@@ -15,28 +14,47 @@ Use the `ionic --help` command for more detailed task information.
15
14
$ npm install -g ionic
16
15
```
17
16
18
-
*Note: For a global install of `-g ionic`, OSX/Linux users may need to prefix the command with `sudo` or can setup [proper file permissions on OSX for npm](http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/) to install without `sudo`. *
17
+
*Note: For a global install of `-g ionic`, OSX/Linux users may need to prefix the command with `sudo` or can setup [proper file permissions on OSX for npm](http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/) to install without `sudo`.*
18
+
19
+
20
+
Minimal node requirements:
21
+
22
+
- NodeLTS or greater
23
+
- NPM 3x
19
24
20
-
*Please ensure that you have npm 2.7+ installed. We are now depending on scoped npm packages which were not introduced until this version. This occurred around the time of NodeJS 0.12.2*
21
25
22
26
23
27
## Starting an Ionic App
24
28
29
+
To start a Ionic 1x app, run:
30
+
25
31
```bash
26
32
$ ionic start myapp [template]
27
33
```
28
34
29
-
Starter templates can either come from a named template, a Github repo, a Codepen, or a local directory. A starter template is what becomes the `www` directory within the Cordova project.
35
+
To start a Ionic 2 app, run:
36
+
37
+
```bash
38
+
$ ionic start myapp [template] --v2
39
+
```
40
+
41
+
Starter templates can either come from a named template, a Github repo, a Codepen, or a local directory. A starter template is what becomes the `www` directory for a V1 project, and a `src` directory for a V2 project
* Any Github repo url, ex: [https://github.com/driftyco/ionic-starter-tabs](https://github.com/driftyco/ionic-starter-tabs)
@@ -62,7 +80,7 @@ __Command-line flags/options:__
62
80
[--id|-i] ............ Package name set in the <widget id> config
63
81
ex: com.mycompany.myapp
64
82
[--no-cordova|-w] .... Do not create an app targeted for Cordova
65
-
[--sass|-s] ........... Setup the project to use Sass CSS precompiling
83
+
[--sass|-s] ........... Setup the project to use Sass CSS precompiling (V1 only)
66
84
[--list|-l] .......... List starter templates available
67
85
68
86
[--io-app-id] ......... The Ionic.io app ID to use
@@ -75,7 +93,7 @@ $ ionic platform ios android
75
93
76
94
## Testing in a Browser
77
95
78
-
Use `ionic serve` to start a local development server for app dev and testing. This is useful for both desktop browser testing, and to test within a device browser which is connected to the same network. Additionally, this command starts LiveReload which is used to monitor changes in the file system. As soon as you save a file the browser is refreshed automatically. View [Using Sass](https://github.com/driftyco/ionic-cli/blob/master/README.md#using-sass) if you would also like to have `ionic serve` watch the project's Sass files.
96
+
Use `ionic serve` to start a local development server for app dev and testing. Additionally, this command starts LiveReload which is used to monitor changes in the file system. As soon as you save a file the browser is refreshed automatically. View [Using Sass](https://github.com/driftyco/ionic-cli/blob/master/README.md#using-sass) if you would also like to have `ionic serve` watch the project's Sass files.
79
97
80
98
```bash
81
99
$ ionic serve [options]
@@ -87,33 +105,6 @@ $ ionic serve [options]
87
105
$ ionic build ios
88
106
```
89
107
90
-
## Live Reload App During Development (beta)
91
-
92
-
The `run` or `emulate` command will deploy the app to the specified platform devices/emulators. You can also run __live reload__ on the specified platform device by adding the `--livereload` option. The live reload functionality is similar to `ionic serve`, but instead of developing and debugging an app using a standard browser, the compiled hybrid app itself is watching for any changes to its files and reloading the app when needed. This reduces the requirement to constantly rebuild the app for small changes. However, any changes to plugins will still require a full rebuild. For live reload to work, the dev machine and device must be on the same local network, and the device must support [web sockets](http://caniuse.com/websockets).
93
-
94
-
With live reload enabled, an app's console logs can also be printed to the terminal/command prompt by including the `--consolelogs` or `-c` option. Additionally, the development server's request logs can be printed out using `--serverlogs` or `-s` options.
95
-
96
-
__Command-line flags/options for `run` and `emulate`:__
97
-
98
-
[--livereload|-l] ....... Live Reload app dev files from the device (beta)
[--serverlogs|-s] ....... Print dev server logs to Ionic CLI (live reload req.)
101
-
[--port|-p] ............. Dev server HTTP port (8100 default, live reload req.)
102
-
[--livereload-port|-i] .. Live Reload port (35729 default, live reload req.)
103
-
[--all|-a] .............. Specify to run on all addresses, 0.0.0.0, so you can view externally
104
-
[--browser|-w] .......... Specifies the browser to use (safari, firefox, chrome)
105
-
[--browseroption|-o] .... Specifies a path to open to (/#/tab/dash)
106
-
[--debug|--release]
107
-
108
-
While the server is running for live reload, you can use the following commands within the CLI:
109
-
110
-
restart or r to restart the client app from the root
111
-
goto or g and a url to have the app navigate to the given url
112
-
consolelogs or c to enable/disable console log output
113
-
serverlogs or s to enable/disable server log output
114
-
quit or q to shutdown the server and exit
115
-
116
-
117
108
## Emulating your app
118
109
119
110
Deploys the Ionic app on specified platform emulator. This is simply an alias for `run --emulator`.
@@ -196,26 +187,19 @@ When starting a new app and adding a platform `ionic platform add ios` - the def
196
187
197
188
## Crosswalk for Android
198
189
199
-
In v1.3.0 and later, you can now specify which browser to use in your Cordova Android projects. Currently we only support [Crosswalk](https://crosswalk-project.org/) and have plans to support more browsers later.
200
-
201
-
Execute `ionic browser add crosswalk` to add the Crosswalk browser to your Android project. By default, this will install the `12.41.296.5` version of Crosswalk.
190
+
To install [Crosswalk](https://crosswalk-project.org/) for Android run:
202
191
203
-
If you'd like to specify a different version of Crosswalk, run `ionic browser list` to see which browsers are available and what versions. Then run `ionic browser add [email protected]`.
We've extended the serve command to open the new Lab UI that features iOSand Android side-by-side.
312
+
We've extended the serve command to open the new Lab UI that features iOS, Android, and Windows side-by-side.
329
313
330
314
```bash
331
315
$ ionic serve --lab
332
316
```
333
317
334
-
If you've used the serve command before, you'll feel right at home with this one. Just like serve, it opens your app in a browser, but now it shows you what your app will look like on a phone, with both iOS and Android side by side.
318
+
If you've used the serve command before, you'll feel right at home with this one. Just like serve, it opens your app in a browser, but now it shows you what your app will look like on a phone, with both iOS, Android, Windows side by side.
335
319
336
320
And of course, it supports Live Reload and all the other goodies we've added over the last couple of months.
337
321
322
+
NOTE: This does **not** emulate cordova or cordova plugins. So while the UI may feel like a native app, you'll still want to deploy to a device to test plugins.
323
+
338
324
## Serving an alternate document root
339
325
340
326
If you'd like to test your app in the browser and you use a folder other than the default of `www`, you can specify this folder in your `ionic.config.json` file.
@@ -356,17 +342,6 @@ It is also advised you specify the watch patterns for this document root as well
356
342
357
343
```
358
344
359
-
## Update Ionic lib
360
-
361
-
Update Ionic library files, which are found in the `www/lib/ionic` directory. If bower is being used
362
-
by the project, this command will automatically run `bower update ionic`, otherwise this command updates
363
-
the local static files from Ionic's CDN.
364
-
365
-
```bash
366
-
$ ionic lib update
367
-
```
368
-
*Note: Using bower? This command does not update Ionic's dependencies. Run `bower update` to update Ionic and all of it's dependencies defined in `bower.json`.*
369
-
370
345
## Packaging an app (beta)
371
346
372
347
Using Ionic's service, you can compile and package your project into an app-store ready app without
By default, starter projects are hooked up to Ionic's precompiled CSS file, which is found in the project's `www/lib/ionic/css` directory, and is linked to the app in the head of the root `index.html` file. However, Ionic projects can also be customized using [Sass](http://sass-lang.com/), which gives developers and designers "superpowers" in terms of creating and maintaining CSS. Below are two ways to setup Sass for your Ionic project (the `ionic setup sass` command simply does the manual steps for you). Once Sass has been setup for your Ionic project, then the `ionic serve` command will also watch for Sass changes.
383
+
By default, V1 starter projects are hooked up to Ionic's precompiled CSS file, which is found in the project's `www/lib/ionic/css` directory, and is linked to the app in the head of the root `index.html` file. However, projects can also be customized using [Sass](http://sass-lang.com/), which gives developers and designers "superpowers" in terms of creating and maintaining CSS. Below are two ways to setup Sass for your Ionic project (the `ionic setup sass` command simply does the manual steps for you). Once Sass has been setup for your Ionic project, then the `ionic serve` command will also watch for Sass changes.
409
384
410
-
#### Setup Sass Automatically
385
+
For V2 projects, there's nothing you need to do! Ionic 2 projects by default are setup with sass and come with all the build process enabled.
386
+
387
+
#### Setup Sass Automatically (V1)
411
388
412
389
ionic setup sass
413
390
414
391
415
-
#### Setup Sass Manually
392
+
#### Setup Sass Manually (V1)
416
393
417
394
1. Run `npm install` from the working directory of an Ionic project. This will install [gulp.js](http://gulpjs.com/) and a few handy tasks, such as [gulp-sass](https://www.npmjs.org/package/gulp-sass) and [gulp-minify-css](https://www.npmjs.org/package/gulp-minify-css).
418
395
2. Remove `<link href="lib/ionic/css/ionic.css" rel="stylesheet">` from the `<head>` of the root `index.html` file.
@@ -476,16 +453,7 @@ Use the `ionic link <appId>` command to set your Ionic App ID to continue workin
476
453
477
454
Use the `ionic share <email>` command to have an email sent to another person to have them view the Ionic application you are using. Note: You must have an [Ionic Cloud](http://ionic.io/) account as well as the user you are sharing with.
478
455
479
-
# Ionic Docs
480
-
481
-
To get Ionic documentation from the Ionic CLI, try using the `ionic docs` command. The command will look up your currently used Ionic version and open the docs specific for that version. Ex: RC0, RC1, etc.
482
-
483
-
To view all docs, `ionic docs ls`.
484
-
485
-
To get help with a doc you may not remember, just type the name close enough: `ionic docs list` and you will be prompted for suggestions that may match.
486
-
487
-
488
-
# Ionic Hooks
456
+
# Ionic Hooks (V1)
489
457
490
458
Ionic provides some default hooks for you to use in your Cordova application. In versions prior to 1.3.18, these hooks were automatically installed via the `ionic platform` command.
491
459
@@ -496,82 +464,13 @@ If you were a user who would still like to use those hooks, you can re-install t
496
464
If you would like to remove these hooks yourself, use `ionic hooks remove` to get rid of them.
497
465
498
466
499
-
# Ionic State
500
-
501
-
Ionic now provides a command to help you manage the state of your Ionic application. Previously Cordova hooks were used to save platforms and plugins to your `package.json` file.
502
-
503
-
Now when using `ionic platform add`, `ionic platform rm`, `ionic plugin add`, or `ionic plugin rm`, the state command will automatically be used to save the platform or plugin state to the `package.json` file.
504
-
505
-
If you would like to avoid saving plugins or platforms to the `package.json` file - pass in the `--nosave` option. (`ionic plugin add org.apache.cordova.file --nosave`).
506
-
507
-
Your package.json file might look something like the following:
The `ionic state save` command does some lookup in your platforms and plugins to save the current state of your cordova application.
542
-
543
-
First it looks in your platforms folder to see which platforms are installed, and saves the name and version in your `package.json` file under the `cordovaPlatforms` attribute.
544
-
545
-
Second it looks at your plugins `fetch.json` file to save the plugins installed both from the Cordova registry, locally installed plugins, as well as remote plugins from github or a remote HTTP url.
546
-
547
-
## ionic state restore
548
-
549
-
The `ionic state restore` command looks at the `cordovaPlugins` and `cordovaPlatforms` attributes in your `package.json` file to restore your application with those platforms and plugins.
550
-
551
-
In the package.json file, `cordovaPlugins` will be stored as just their `ID` if they are installed from the Cordova registry. However, if they are local or remote, they will be stored as an object with those properties. Also to note, variables are stored for plugins with variables like the Facebook connect plugin.
552
-
553
-
The `cordovaPlatforms` follow the same convention of either an `ID` for the platform name, if they are local or remote, they will be stored as an object with those properties.
554
-
555
-
If you'd like, you can populate the `cordovaPlugins` and `cordovaPlatforms` by hand, then use the `ionic state restore` command to get your app ready to go.
556
-
557
-
## ionic state clear
558
-
559
-
The `ionic state clear` method will clear out your platforms and plugins directories, as well as removing the `cordovaPlugins` and `cordovaPlaforms` attributes in your `package.json` file.
560
-
561
-
## ionic state reset
562
-
563
-
The `ionic state reset` method will first remove your platforms and plugins folders. Then it will look at your `package.json` file to re-install the platforms and plugins as specified there.
564
-
565
-
This command can be helpful for you to reinstall your plugins and platforms to get a fresh start.
566
-
567
-
568
467
# Ionic CLI 2.0
569
468
570
469
## Ionic Generators
571
470
572
-
First class support has come to the Ionic CLI to scaffold and generate Ionic and Angular 2 components. To use this feature, first install the V2 Ionic CLI: `npm install ionic@alpha` and start an app.
471
+
First class support has come to the Ionic CLI to scaffold and generate Ionic and Angular 2 components.
573
472
574
-
Once in the app folder, use the `generate` command (alias: `g`).
473
+
From your app directory, use the `generate` command (alias: `g`).
575
474
576
475
Usage:
577
476
*`ionic generate page About` - Generate a page named About with HTML, JavaScript, and Sass named `about`.
0 commit comments