👨💻Developer 💜 Nodejs, React Native, Expo | Tech Writer at Draftbit| 2.5M+ views on Medium
The Ionic CLI is your go-to tool for developing Ionic apps.
Ionic CLI is a great tool when it comes to avoid writing a lot of boilerlpate code. It generates pages, services, can run or emulate your Ionic application with and generate needed resources for the mobile application such as splash screen.
This is a quick reference into Ionic CLI.
You can install it with npm:
To check if it has installed correctly, in your terminal window, type:
To start with a new mobile application, Ionic framework provides different set of ready-to-use templates:
For creating a new project:
With update to Ionic 3, no more adding tages such as
--v2 after the template name in the above command. By default, Ionic app generated will be of version 2/3. To generate an Ionic app of version 1 (with good ol' Angularjs):
cd into your project’s directory, serve your app on your local machine with
To serve on a different port:
–-lab tag to see your app side by side on multiple platforms (such as iOS, Android and Windows Mobile):
To serve without live reload:
To generate a new page:
To generate a provider/service:
Know them all- List the available generators:
To generate the app icon and splash screen with resources:
Or, just the splash screen:
Now, generate resources for a specific platform:
To add a target mobile platform for the app to use:
To start an emulator:
Emulate with livereload:
Let’s say, I have an iOS device connected, so to run the app on that device:
Another advantage of using Ionic CLI tool is that it initialises a git repository when creating an Ionic project using the
ionic start command from the terminal with an
initial commit already. You can verify that by running:
You can also find me on Twitter
Create your free account to unlock your custom reading experience.