The Tutorial aims to provide users with a comprehensive understanding of how Re-Earth plugins are developed. Let's dive into the step-by-step process of creating a simple plugin together.

Step 1: Create a project directory

To begin, choose a location of your preference and create a new directory. This directory will serve as the container for your plugin code. Feel free to name the directory as you wish. For the purpose of this guide, we will name it test-plugin.

Step 2: Describe a manifest for the plugin

The Manifest plays a crucial role as it serves as the metadata for your plugin. It includes essential details such as the ID and name of the plugin, the functionalities it extends, and the configuration options it provides to users.

Create a new file named reearth.yml and edit its content as follows:

reearth.yml

yamlCopy code
id: test-plugin
name: Test plugin
version: 1.0.0
extensions:
  - id: test-widget
    type: widget
    name: Test

CAUTION

By following these two initial steps, you have set the foundation for developing your Re-Earth plugin. The manifest file (reearth.yml) holds essential information about your plugin's identity, purpose, and functionalities. From here, you can proceed to implement the plugin's code and explore the vast possibilities that Re-Earth's plugin system offers.

Step 3. Implement the first extension

Actually, a plugin is a collection of units called extensions. A plugin can have only one extension or multiple extensions.

Let's go ahead and implement the first extension. As described in the manifest in the previous step, the ID of the extension we will implement is test-widget. Create a file named test-widget.js with the extension .js appended to this ID.

CAUTION

Note that if you make a mistake with this file name, the plugin will not work. Other than the extension, the rest of the file must match the ID completely.

Then edit the JS file:

test-widget.js