This post is trending. 3,002 Views

Ionic CLI 3.0 Cheatsheet

Ionic CLI cheatsheet

Ionic CLI is the default and easiest way to work with ionic projects. In this tutorial we will learn the ins and outs of Ionic CLI.

Download PDF

Commands

1. Docs

Opens the ionic documentation website
Usage: ionic docs

2. Generate

Used to Generate pipes, components, pages, directives, providers, and tabs (ionic-angular >= 3.0.0)
Usage: ionic generate [type] [name]

Parameters

  • type can be any of component, directive, page, pipe, provider, tabs
  • name name for the item you are generating

Examples

ionic generate //generate various elements using interactive mode. Allows you to choose what to generate and give the name
ionic generate component //will ask for the name of the component
ionic generate component foo //will generate component named foo

3. Info

Used to print the system and development environment information.
Usage: ionic info

4. Link

Connect your local app to Ionic

Usage: ionic link [app_id]

Parameters

  • app_id The ID of the app to link (e.g. a1b2c3d4)

Examples

ionic link 
ionic link a1b2c3d4

5. Login

Login with your Ionic ID

Usage: ionic login

Parameters

  • email Your email address
  • password Your password

Examples

ionic login 
ionic login john@example.com
ionic login hello@example.com secret

6. Serve

Start a local development server for app dev/testing

Usage: ionic serve

Options

  • –consolelogs, -c Print app console logs to Ionic CLI
  • –serverlogs, -s Print dev server logs to Ionic CLI
  • –port, -p Dev server HTTP port
  • –livereload-port, -r Live Reload port
  • –nobrowser, -b Disable launching a browser
  • –nolivereload, -d Do not start live reload
  • –noproxy, -x Do not add proxies
  • –a* dress Network address for server
  • –browser, -w Specifies the browser to use (safari, firefox, chrome)
  • –browseroption, -o Specifies a path to open to (/#/tab/dash)
  • –lab, -l Test your apps on multiple platform types in the browser
  • –nogulp Disable gulp
  • –nosass Disable sass
  • –platform, -t Start serve with a specific platform (ios/android)

Examples

ionic serve --lab --consolelogs -s

7. Signup

Opens browser to create Ionic Cloud account

Usage: ionic signup

8. Start

Create a new Ionic project

Usage: ionic start [template]

Parameters

  • name The name of your project directory
  • template The starter template to use (e.g. blank, tabs; use –list to see all)

Options

  • –type Type of project to start (e.g. ionic-angular, ionic1)
    –app-name, -n Human-readable name (use quotes around the name)
  • –list, -l List starter templates available
  • –skip-deps Skip npm/yarn package installation of dependencies
  • –yarn Opt-in to using yarn (instead of npm)
  • –skip-link Do not link app to an Ionic Account

Examples

ionic start 
ionic start mynewapp blank
ionic start mynewapp tabs --type ionic-angular
ionic start mynewapp blank --type ionic1

9. Telemetry

Opt in and out of telemetry

Usage: ionic telemetry [status]

Parameters

  • status on or off

10. Upload

Upload a new snapshot of your app

Usage: ionic upload

Options

  • –note Give this snapshot a nice description
  • –deploy Deploys this snapshot to the given channel
  • –nobuild Do not invoke a build for this upload

Examples

ionic upload 

11. Cordova build

Build (prepare + compile) an Ionic project for a given platform

Usage: ionic cordova build

Parameters

  • platform The platform to build: ios, android

Options

  • **–prod Build the application for production
  • **–debug Create a Cordova debug build
  • **–release Create a Cordova release build
  • **–device Deploy Cordova build to a device
  • **–emulator Deploy Cordova build to an emulator
  • **–buildConfig Use the specified Cordova build configuration

Examples

ionic cordova build ios

12. Cordova compile

Compile native platform code

Usage: ionic cordova compile

Parameters

  • platform The platform to emulate: ios, android

Examples

ionic cordova compile ios

13. Cordova emulate

Emulate an Ionic project on a simulator or emulator

Usage: ionic cordova emulate

Parameters

  • platform The platform to emulate: ios, android

Options

  • –livereload, -l Live reload app dev files from the device
  • –address Use specific address (livereload req.)
  • –consolelogs, -c Print app console logs to Ionic CLI
  • –serverlogs, -s Print dev server logs to Ionic CLI
  • –port, -p Dev server HTTP port
  • –livereload-port, -r Live Reload port
  • –prod Create a prod build with app-scripts
  • –list List all available Cordova run targets
  • –debug Create a Cordova debug build
  • –release Create a Cordova release build
  • –device Deploy Cordova build to a device
  • –target Deploy Cordova build to a device (use –list to see all)

Examples

ionic cordova emulate ios --livereload -c -s

14. Cordova platform

Add or remove a platform target for building an Ionic app

Usage: ionic cordova platform [action] [platform]

Parameters

  • action add, remove, or update a platform; list, check, or save all project platforms
  • platform The platform that you would like to add (e.g. ios, android)

Options

  • –noresources, -r Do not add default Ionic icons and splash screen resources (corresponds to add)

Examples

ionic cordova platform add android

15. Cordova plugin

Manage Cordova plugins

Usage: ionic cordova plugin [action] [plugin]

Parameters

  • action add or remove a plugin; list or save all project plugins
  • plugin The name of the plugin (corresponds to add and remove)

Options

  • –force Forve overwrite the plugin if it exists (corresponds to add)

Examples

ionic cordova plugin add cordova-plugin-inappbrowser@latest
ionic cordova plugin list

16. Cordova prepare

Transform metadata to platform manifests and copies assets to Cordova platforms

Usage: ionic cordova prepare [platform]

Parameters

  • platform The platform you would like to prepare (e.g. ios, android)

17. Cordova resources

Automatically create icon and splash screen resources

Usage: ionic cordova resources [platform]

Parameters

  • platform The platform for which you would like to generate resources (e.g. ios, android)

Optionss

  • –icon, -i Generate icon resources
  • –splash, -s Generate splash screen resources

Examples

ionic cordova resources 

18. Cordova run

Run an Ionic project on a connected device

Usage: ionic cordova run

Parameters

  • platform The platform to run: ios, android

Options

  • –livereload, -l Live reload app dev files from the device
  • –address Use specific address (livereload req.)
  • –consolelogs, -c Print app console logs to Ionic CLI
  • –serverlogs, -s Print dev server logs to Ionic CLI
  • –port, -p Dev server HTTP port
  • –livereload-port, -r Live Reload port
  • –prod Create a prod build with app-scripts
  • –list List all available Cordova run targets
  • –debug Create a Cordova debug build
  • –release Create a Cordova release build
  • –device Deploy Cordova build to a device
  • –emulator Deploy Cordova build to an emulator
  • –target Deploy Cordova build to a device (use –list to see all)
  • –buildConfig Use the specified Cordova build configuration

Examples

ionic cordova run ios --livereload -c -s

19. Package build

Start a package build

Usage: ionic package build

Parameters

  • platform The platform to target: ios, android

Options

  • –prod Mark this build as a production build
  • –release Mark this build as a release build
  • –profile, -p The security profile to use with this build
  • –note Give the package snapshot a note

Examples

ionic package build android
ionic package build ios --profile dev
ionic package build android --profile prod --release --prod

20. Package download

Download your packaged app

Usage: ionic package download [id]

Parameters

  • id The build ID to download. Defaults to the latest build

Options

  • –destination, -d The download destination directory

Examples

ionic package download 
ionic package download 15
ionic package download -d my_builds

21. Package info

Get info about a build

Usage: ionic package info [id]

Parameters

  • id The build ID. Defaults to the latest build

Examples

ionic package info 
ionic package info 15

22. Package list

List your cloud builds

Usage: ionic package list

Examples

ionic package list

Download PDF

Happy Ionic Developing!!!

Related Posts

This post is trending.

Setting up Ionic View for Testing Ionic App

Introduction Ionic View is by far the best thing Ionic framework provides. The problem with hybrid apps is that we need to […]

This post is trending.

Beautiful Timeline Component in Ionic 3

In this tutorial we will be building a beautiful timeline component to display any suitable content from blog posts to comments or […]

%d bloggers like this: