Plugins are very essential part of an app building framework. You can add several unique features to your app. To have plugins, it’s also not an easy task to manage all the plugging. So, to install and manage plugins, Cordova provides Plugman. You can use Plugman , when you want to run your app on one particular platform i.e. building a native app. But, you should use cordova-cli when you want to create cross-platform app that will modify the plugins for different platforms.
You can also read: Creating First Application in Cordova
Here are the steps to use Plugman:
Step 1 - Installing Plugman
To install plugman, open command prompt window and run the following piece of code.
C:\Users\username\Desktop\CordovaProject>npm install -g plugman
Step 2 - Installing Plugins
To show you how to install Cordova plugin using plugman, we have used Camera plugin as example.
C:\Users\username\Desktop\CordovaProject>plugman
install --platform android --project platforms\android
--plugin cordova-plugin-camera
plugman uninstall --platform android --project platforms\android
--plugin cordova-plugin-camera
- Platform − platform operating system that we are using (android, Ios, amazon-fireos, wp8, blackberry10).
- Project − path where the project is built. In our case it is platforms\android directory.
- Plugin − the plugin that we want to install.
If you set valid parameters, the command prompt window should output the following.
Additional Methods
You can use uninstall method in similar way.
C:\Users\username\Desktop\CordovaProject>plugman uninstall
--platform android --project platforms\android --plugin cordova-plugin-camera
The command prompt console will have the following output.
Plugman provides some additional methods that can be used. The methods are mentioned below in the table:
SN |
Method & Details |
1 |
install Used for installing Cordova plugins. |
2 |
uninstall Used for uninstalling Cordova plugins. |
3 |
fetch Used for copying Cordova plugin to a specific location. |
4 |
prepare Used for updating configuration file to help JS module support. |
5 | adduser Used for adding user account to the registry. |
6 | publish Used for publishing plugin to the registry. |
7 | unpublish Used for unpublishing plugin from the registry. |
8 | search Used for searching the plugins in the registry. |
9 | config Used for registry settings configuration. |
10 | create Used for creating custom plugin. |
11 | platform Used for adding or removing platform from the custom created plugin. |
Also Read: Introduction to Apache Cordova
Additional Commands
If you are stuck somewhere and need any assistance, you can always use plugman -help command for any help.
The version installed currently can be checked by using plugman -v.
To search for any plugin, you can use plugman search command, and
You can change the plugin registry by using plugman config set registry command.
Leave Comment