ionic
Develop, build, and run Ionic applications
TLDR
Create a new project
Start a local dev server for app dev/testing
Generate new app component, directive, page, pipe, provider or tabs
Run app on an Android/iOS device
Check the health of an Ionic app
Display versions of Ionic, Cordova, environment, etc.
SYNOPSIS
ionic [command] [options]
ionic [options]
ionic help [command]
PARAMETERS
--version, -v
Display the Ionic CLI version.
--help, -h
Display help for the command or a specific subcommand.
--verbose
Enable verbose output, showing more details during execution.
--no-color
Disable colored output in the terminal.
--confirm
Prompt for confirmation before executing potentially destructive actions.
start
Create a new Ionic project with a specified name and template (e.g., 'tabs', 'blank', 'sidemenu'). The --type flag specifies the framework (angular, react, vue).
serve [--port=
Serve the Ionic application in the browser for development. --port specifies the port number, --external allows access from other devices on the network, and --lab opens a multi-platform view.
build [--prod] [--configuration=
Build the Ionic application for production or testing. --prod optimizes for production, and --configuration specifies a build configuration.
capacitor add
Add a native platform (e.g., 'ios', 'android') to the project using Capacitor, enabling native builds.
capacitor sync
Sync web assets and plugin code to the native project directory for the specified platform.
cordova add
Add a native platform (e.g., 'ios', 'android') to the project using Cordova (legacy method).
generate
Generate a new Ionic artifact like a page, component, service, provider, or module.
DESCRIPTION
The ionic command is the official command-line interface (CLI) for the Ionic Framework, an open-source UI toolkit for building high-quality, cross-platform mobile, desktop, and web applications. It leverages standard web technologies like HTML, CSS, and JavaScript, integrating seamlessly with popular frontend frameworks such as Angular, React, and Vue. The CLI provides a powerful set of tools to streamline the entire application development lifecycle. Developers use it to scaffold new projects, serve applications locally for testing, build production-ready packages, integrate with native runtime layers like Capacitor or Cordova, generate components, pages, and services, and manage various aspects of their Ionic projects. Its primary goal is to accelerate development by providing sensible defaults and automation for common tasks, enabling web developers to target multiple platforms from a single codebase.
CAVEATS
The ionic command is not a native Linux utility but a Node.js package installed via npm. It requires Node.js and npm to be pre-installed on the system. Its functionality heavily relies on a working Node.js environment and various JavaScript dependencies. It's primarily used for web and hybrid mobile application development and doesn't perform typical system-level operations.
INSTALLATION
To use the ionic command, you must first install Node.js and npm. Then, install the Ionic CLI globally using npm:
npm install -g @ionic/cli
PROJECT STRUCTURE
An Ionic project typically consists of a standard web application structure (HTML, CSS, JavaScript/TypeScript) along with configuration files specific to Ionic, Capacitor, or Cordova. The CLI manages these files and integrates them with native platform projects.
HISTORY
The Ionic Framework and its CLI were first released in 2013 by Drifty Co. (later acquired by Roposo, then part of the Congruent Group). Initially, Ionic was built on top of AngularJS and Apache Cordova. Over the years, it evolved to support other popular frontend frameworks like React and Vue.js, and introduced Capacitor as its preferred native runtime, offering a more modern alternative to Cordova. The ionic CLI has continuously been updated to reflect these changes, providing tools that integrate with the latest web technologies and native platform capabilities, solidifying its position as a leading tool for cross-platform app development.
SEE ALSO
npm: Node Package Manager for installing JavaScript packages., node: Node.js runtime environment., capacitor: Cross-platform native runtime for web apps., cordova: Platform for building native mobile apps with web technologies., ng (Angular CLI): Command-line interface for Angular applications., react-scripts: Configuration and scripts for React apps., vue-cli-service: Command-line interface for Vue.js applications.