Cordova custom plug-in, cordova custom

Source: Internet
Author: User

Cordova custom plug-in, cordova custom
Cordova/phonegap custom plug-in

While using cordova, many open-source plug-ins are provided officially. However, sometimes you need to write your own plug-ins to meet certain requirements.

In the past, the cordova plug-in was always configured manually. For details, refer to phonegap manual configuration plug-in.

Today, we will introduce the official plug-in man to create plug-ins.

Use of pluman

First, install plumam
npm install -g plugman

After installation, you can create a plugin
plugman create --name <pluginName> --plugin_id <pluginID> --plugin_version <version> [--path <directory>] [--variable NAME=VALUE]

Parameters:

  • PluginName: The name of the plugin
  • PluginID: An ID for the plugin, ex: org. bar. foo
  • Version: A version for the plugin, ex: 0.0.1
  • Directory: An absolute or relative path for the directory where the plugin project will be created
  • Variable NAME = VALUE: Extra variables such as description or Author
eg: plugman create --name HelloPlugin --plugin_id helloPlugin --plugin_version 0.0.1 ,

This command will create a HelloPlugin plug-in the current directory

Finally, if you want to add a plug-in to a project after development, you just need to jump to your project directory on the console as usual when adding a plug-in, and then run the following command:(Add is followed by the Directory of the plug-in)

cordova plugin add /Users/laozhuorun/Desktop/HelloPlugin

End

Now, a custom plug-in is created and added to the project.

You need to modify the plug-in after it is added to the project during development. After you delete the plug-in from the project, add the modified plug-in again.

Delete the plugin: cordova plugin remove XXXXX (your plugin_id ).

If you do not know the id of your plug-in, you can view it through the command line.

cordova plugin list 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.