Search⌘ K
AI Features

Working With Capacitor

Explore how to add Capacitor to existing or new Ionic projects, initialize with app details, and configure native platforms like iOS and Android. Understand the use of Capacitor plugins to access native device features and manage platform integrations effectively.

Adding Capacitor to a project

Capacitor can be added to an existing frontend project or by starting a new project.

To add Capacitor to an existing non-Ionic frontend project, we simply need to run the following from the command line:

cd name-of-project-directory-here
npm install @capacitor/core @capacitor/cli --save-dev

Note: Your frontend project must have a valid package.json file and a <head> element within the project’s main index.html file, as this will be used to inject Capacitor into upon app initialization.

Once installed, Capacitor needs to be initialized with ...