Skip to main content

Resources

Resource References allow you use external files in Blueprints

In the installPlugin step in the example above, we reference the https://downloads.wordpress.org/plugins/friends.latest-stable.zip file by using the wordpress.org/plugins resource reference.

The following resource references are available:

URLReference

The URLReference resource is used to reference files that are stored on a remote server. The URLReference resource is defined as follows:

type URLReference = {
resource: 'url';
url: string;
};

To use the URLReference resource, you need to provide the URL of the file. For example, to reference a file named "index.html" that is stored on a remote server, you can create a URLReference as follows:

{
"resource": "url",
"url": "https://example.com/index.html"
}

CoreThemeReference

The CoreThemeReference resource is used to reference WordPress core themes. The CoreThemeReference resource is defined as follows:

type CoreThemeReference = {
resource: 'wordpress.org/themes';
slug: string;
version?: string;
};

To use the CoreThemeReference resource, you need to provide the slug of the theme. For example, to reference the "Twenty Twenty-One" theme, you can create a CoreThemeReference as follows:

{
"resource": "wordpress.org/themes",
"slug": "twentytwentyone"
}

CorePluginReference

The CorePluginReference resource is used to reference WordPress core plugins. The CorePluginReference resource is defined as follows:

type CorePluginReference = {
resource: 'wordpress.org/plugins';
slug: string;
version?: string;
};

To use the CorePluginReference resource, you need to provide the slug of the plugin. For example, to reference the "Akismet" plugin, you can create a CorePluginReference as follows:

{
"resource": "wordpress.org/plugins",
"slug": "akismet"
}

VFSReference

The VFSReference resource is used to reference files that are stored in a virtual file system (VFS). The VFS is a file system that is stored in memory and can be used to store files that are not part of the file system of the operating system. The VFSReference resource is defined as follows:

type VFSReference = {
resource: 'vfs';
path: string;
};

To use the VFSReference resource, you need to provide the path to the file in the VFS. For example, to reference a file named "index.html" that is stored in the root of the VFS, you can create a VFSReference as follows:

{
"resource": "vfs",
"path": "/index.html"
}

LiteralReference

The LiteralReference resource is used to reference files that are stored as literals in the code. The LiteralReference resource is defined as follows:

type LiteralReference = {
resource: 'literal';
name: string;
contents: string | Uint8Array;
};

To use the LiteralReference resource, you need to provide the name of the file and its contents. For example, to reference a file named "index.html" that contains the text "Hello, World!", you can create a LiteralReference as follows:

{
"resource": "literal",
"name": "index.html",
"contents": "Hello, World!"
}