Ionic CLI 3.0 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.
- Ionic CLI cheatsheet
- Commands
- 1. Docs
- 2. Generate
- 3. Info
- 4. Link
- 5. Login
- 6. Serve
- 7. Signup
- 8. Start
- 9. Telemetry
- 10. Upload
- 11. Cordova build
- 12. Cordova compile
- 13. Cordova emulate
- 14. Cordova platform
- 15. Cordova plugin
- 16. Cordova prepare
- 17. Cordova resources
- 18. Cordova run
- 19. Package build
- 20. Package download
- 21. Package info
- 22. Package list
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.
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
- typecan be any of component, directive, page, pipe, provider, tabs
- namename 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_idThe 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
- emailYour email address
- passwordYour password
Examples
ionic login
ionic login [email protected]
ionic login [email protected] secret
6. Serve
Start a local development server for app dev/testing
Usage: ionic serve
Options
- consolelogs, cPrint app console logs to Ionic CLI
- serverlogs, sPrint dev server logs to Ionic CLI
- port, pDev server HTTP port
- livereload port, rLive Reload port
- nobrowser, bDisable launching a browser
- nolivereload, dDo not start live reload
- noproxy, xDo not add proxies
- a* dress Network address for server
- browser, wSpecifies the browser to use (safari, firefox, chrome)
- browseroption, oSpecifies a path to open to (/#/tab/dash)
- lab, lTest your apps on multiple platform types in the browser
- nogulpDisable gulp
- nosassDisable sass
- platform, tStart 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
- nameThe name of your project directory
- templateThe starter template to use (e.g. blank, tabs; use list to see all)
Options
- typeType of project to start (e.g. ionic angular, ionic1)
app name, nHuman readable name (use quotes around the name) - list, lList starter templates available
- skip depsSkip npm/yarn package installation of dependencies
- yarnOpt in to using yarn (instead of npm)
- skip linkDo 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
- statuson or off
10. Upload
Upload a new snapshot of your app
Usage: ionic upload
Options
- noteGive this snapshot a nice description
- deployDeploys this snapshot to the given channel
- nobuildDo 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
- platformThe 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
- platformThe 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
- platformThe platform to emulate: ios, android
Options
- livereload, lLive reload app dev files from the device
- addressUse specific address (livereload req.)
- consolelogs, cPrint app console logs to Ionic CLI
- serverlogs, sPrint dev server logs to Ionic CLI
- port, pDev server HTTP port
- livereload port, rLive Reload port
- prodCreate a prod build with app scripts
- listList all available Cordova run targets
- debugCreate a Cordova debug build
- releaseCreate a Cordova release build
- deviceDeploy Cordova build to a device
- targetDeploy 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
- actionadd, remove, or update a platform; list, check, or save all project platforms
- platformThe platform that you would like to add (e.g. ios, android)
Options
- noresources, rDo 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
- actionadd or remove a plugin; list or save all project plugins
- pluginThe name of the plugin (corresponds to add and remove)
Options
- forceForve 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
- platformThe 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
- platformThe platform for which you would like to generate resources (e.g. ios, android)
Optionss
- icon, iGenerate icon resources
- splash, sGenerate splash screen resources
Examples
ionic cordova resources
18. Cordova run
Run an Ionic project on a connected device
Usage: ionic cordova run
Parameters
- platformThe platform to run: ios, android
Options
- livereload, lLive reload app dev files from the device
- addressUse specific address (livereload req.)
- consolelogs, cPrint app console logs to Ionic CLI
- serverlogs, sPrint dev server logs to Ionic CLI
- port, pDev server HTTP port
- livereload port, rLive Reload port
- prodCreate a prod build with app scripts
- listList all available Cordova run targets
- debugCreate a Cordova debug build
- releaseCreate a Cordova release build
- deviceDeploy Cordova build to a device
- emulatorDeploy Cordova build to an emulator
- targetDeploy Cordova build to a device (use list to see all)
- buildConfigUse 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
- platformThe platform to target: ios, android
Options
- prodMark this build as a production build
- releaseMark this build as a release build
- profile, pThe security profile to use with this build
- noteGive 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
- idThe build ID to download. Defaults to the latest build
Options
- destination, dThe 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
- idThe 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
Happy Ionic Developing!!!