Step 2: Applying the Resources in Configuration as Code
Plugins can be configured on an account using the Yext CLI. More information about how to use the Yext CLI can be found in the Getting Started with the CLI guide.
Let’s look at a specific example. If you want to make a Plugin resource with a function to convert a string to uppercase, you can accomplish this by defining the following files:
default/platform/plugin/_resource.json
{
"$id": "UppercasePlugin",
"$schema": "https://schema.yext.com/config/platform/plugin/v1"
}
default/platform/plugin/mod.ts
export function fn(a: string) {
return `${a.toUpperCase()}`;
}
Once these resources are defined, you can run the following apply command:
yext resources apply ~/path/to/directory
Once you apply this new resource, a Plugin will be instantiated with the provided ID.
<% elem.innerText %>