The Capacitor workflow involves a few consistent tasks:
Capacitor turns your web app into a native binary for each platform. Thus, much of your work will consist of developing and then building a mobile-focused web app.
You will interact with the native platform underneath using Capacitor’s plugins (such as Camera), or by using existing Cordova plugins with Capacitor’s Cordova Compatibility.
As a final step, you will build your application using a command similar to:
npm run buildIf you are using a framework, follow your framework’s build process. If, for example, you are using Ionic, this would be:
ionic buildWhen you are ready to run your app natively on a device or in a simulator, copy your built web assets using:
npx cap copyCapacitor uses the Native IDEs to build, simulate, and run your app. To open one, run:
npx cap openIn some cases, the Capacitor app needs to be updated, such as when installing new plugins.
To install new plugins (including Cordova ones), run:
npm install really-cool-plugin
npx cap updateTo check if there are any new updates to Capacitor itself, run
npx cap doctor to print out the current installed dependencies as well view the latest available.
To update Capacitor Core and CLI:
npm install @capacitor/cli@latest
npm install @capacitor/core@latestTo update any or all of the platforms you are using:
npm install @capacitor/ios@latest
npm install @capacitor/android@latestNote: If you don’t want to risk introducing breaking changes, use
npm update @capacitor/package-name instead of @latest as update respects semantic versioning.