|
| 1 | +--- |
| 2 | +slug: /blueprints/steps/resources |
| 3 | +--- |
| 4 | + |
| 5 | +# 参照リソース |
| 6 | + |
| 7 | +<!-- |
| 8 | +# Resources References |
| 9 | +--> |
| 10 | + |
| 11 | +「リソース参照」を使用すると、ブループリントで外部ファイルを使用できるようになります。 |
| 12 | + |
| 13 | +<!-- |
| 14 | +"Resource References" allow you use external files in Blueprints |
| 15 | +--> |
| 16 | + |
| 17 | +:::info |
| 18 | +[`installPlugin`](/blueprints/steps#InstallPluginStep) や [`installTheme`](/blueprints/steps#InstallThemeStep) などのブループリントステップでは、インストールするプラグインまたはテーマの場所を指定する必要があります。 |
| 19 | + |
| 20 | +その場所は、テーマまたはプラグインを含む `.zip` ファイルの [`URL` リソース](#urlreference) として定義できます。また、公式 WordPress ディレクトリに公開されているプラグイン/テーマの場合は、[`wordpress.org/plugins`](#corepluginreference) または [`wordpress.org/themes`](#corethemereference) リソースとして定義することもできます。 |
| 21 | +::: |
| 22 | + |
| 23 | +<!-- |
| 24 | +:::info |
| 25 | +Blueprints steps such as [`installPlugin`](/blueprints/steps#InstallPluginStep) or [`installTheme`](/blueprints/steps#InstallThemeStep) require a location of the plugin or theme to be installed. |
| 26 | +
|
| 27 | +That location can be defined as [a `URL` resource](#urlreference) of the `.zip` file containing the theme or plugin. It can also be defined as a [`wordpress.org/plugins`](#corepluginreference) or [`wordpress.org/themes`](#corethemereference) resource for those plugins/themes published in the official WordPress directories. |
| 28 | +::: |
| 29 | +--> |
| 30 | + |
| 31 | +次のリソース参照が利用可能です。 |
| 32 | + |
| 33 | +<!-- |
| 34 | +The following resource references are available: |
| 35 | +--> |
| 36 | + |
| 37 | +import TOCInline from '@theme/TOCInline'; |
| 38 | + |
| 39 | +<TOCInline toc={toc} /> |
| 40 | + |
| 41 | +### URL 参照 |
| 42 | + |
| 43 | +<!-- |
| 44 | +### URLReference |
| 45 | +--> |
| 46 | + |
| 47 | +`URLReference` リソースは、リモートサーバーに保存されているファイルを参照するために使用されます。`URLReference` リソースは次のように定義されます。 |
| 48 | + |
| 49 | +<!-- |
| 50 | +The `URLReference` resource is used to reference files that are stored on a remote server. The `URLReference` resource is defined as follows: |
| 51 | +--> |
| 52 | + |
| 53 | +```typescript |
| 54 | +type URLReference = { |
| 55 | + resource: 'url'; |
| 56 | + url: string; |
| 57 | +}; |
| 58 | +``` |
| 59 | + |
| 60 | +`URLReference` リソースを使用するには、ファイルの URL を指定する必要があります。例えば、リモートサーバーに保存されている「index.html」という名前のファイルを参照するには、次のように `URLReference` を作成します。 |
| 61 | + |
| 62 | +<!-- |
| 63 | +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: |
| 64 | +--> |
| 65 | + |
| 66 | +```json |
| 67 | +{ |
| 68 | + "resource": "url", |
| 69 | + "url": "https://example.com/index.html" |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +リソース `url` タイプは、[`installPlugin`](/blueprints/steps#InstallPluginStep) や |
| 74 | +[`installTheme`](http://localhost:3000/wordpress-playground/blueprints/steps#InstallThemeStep) などのブループリントステップと組み合わせて使用します。 |
| 75 | +これらのステップでは、インストールするプラグインまたはテーマの場所を定義する `ResourceType` が必要です。 |
| 76 | + |
| 77 | +<!-- |
| 78 | +The resource `url` type works really in combination with blueprint steps such as [`installPlugin`](/blueprints/steps#InstallPluginStep) or |
| 79 | +[`installTheme`](http://localhost:3000/wordpress-playground/blueprints/steps#InstallThemeStep). |
| 80 | +These steps require a `ResourceType` to define the location of the plugin or the theme to install. |
| 81 | +--> |
| 82 | + |
| 83 | +`"resource": "url"` を使用すると、GitHub リポジトリを直接ポイントできる URL を介して、プラグイン/テーマを含む `.zip` の場所を定義できます。 |
| 84 | + |
| 85 | +<!-- |
| 86 | +With a `"resource": "url"` we can define the location of a `.zip` containing the plugin/theme via a URL that can point directly to a GitHub repo. |
| 87 | +--> |
| 88 | + |
| 89 | +:::tip |
| 90 | +Playground プロジェクトは[GitHub Proxy](https://playground.wordpress.net/proxy)を提供しています。これを使用すると、プラグインやテーマを含むリポジトリ(またはリポジトリ内のフォルダ)から `.zip` ファイルを生成できます。このツールは、CORS の問題などを回避するのに非常に便利です。 |
| 91 | +::: |
| 92 | + |
| 93 | +<!-- |
| 94 | +:::tip |
| 95 | +The Playground project provides a [GitHub Proxy](https://playground.wordpress.net/proxy) that allows you to generate a `.zip` from a repository (or even a folder inside a repo) containing your plugin or theme. This tool is very useful for avoiding CORS issues, among others. |
| 96 | +::: |
| 97 | +--> |
| 98 | + |
| 99 | +### コアテーマリファレンス |
| 100 | + |
| 101 | +<!-- |
| 102 | +### CoreThemeReference |
| 103 | +--> |
| 104 | + |
| 105 | +_CoreThemeReference_ リソースは、WordPress コアテーマを参照するために使用されます。_CoreThemeReference_ リソースは以下のように定義されています。 |
| 106 | + |
| 107 | +<!-- |
| 108 | +The _CoreThemeReference_ resource is used to reference WordPress core themes. The _CoreThemeReference_ resource is defined as follows: |
| 109 | +--> |
| 110 | + |
| 111 | +```typescript |
| 112 | +type CoreThemeReference = { |
| 113 | + resource: 'wordpress.org/themes'; |
| 114 | + slug: string; |
| 115 | + version?: string; |
| 116 | +}; |
| 117 | +``` |
| 118 | + |
| 119 | +_CoreThemeReference_ リソースを使用するには、テーマのスラッグを指定する必要があります。例えば、「Twenty Twenty-One」テーマを参照するには、次のように _CoreThemeReference_ を作成します。 |
| 120 | + |
| 121 | +<!-- |
| 122 | +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: |
| 123 | +--> |
| 124 | + |
| 125 | +```json |
| 126 | +{ |
| 127 | + "resource": "wordpress.org/themes", |
| 128 | + "slug": "twentytwentyone" |
| 129 | +} |
| 130 | +``` |
| 131 | + |
| 132 | +### コアプラグインリファレンス |
| 133 | + |
| 134 | +<!-- |
| 135 | +### CorePluginReference |
| 136 | +--> |
| 137 | + |
| 138 | +_CorePluginReference_ リソースは、WordPress コアプラグインを参照するために使用されます。_CorePluginReference_ リソースは以下のように定義されています。 |
| 139 | + |
| 140 | +<!-- |
| 141 | +The _CorePluginReference_ resource is used to reference WordPress core plugins. The _CorePluginReference_ resource is defined as follows: |
| 142 | +--> |
| 143 | + |
| 144 | +```typescript |
| 145 | +type CorePluginReference = { |
| 146 | + resource: 'wordpress.org/plugins'; |
| 147 | + slug: string; |
| 148 | + version?: string; |
| 149 | +}; |
| 150 | +``` |
| 151 | + |
| 152 | +_CorePluginReference_ リソースを使用するには、プラグインのスラッグを指定する必要があります。例えば、「 Akismet 」プラグインを参照するには、次のように _CorePluginReference_ を作成します。 |
| 153 | + |
| 154 | +<!-- |
| 155 | +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: |
| 156 | +--> |
| 157 | + |
| 158 | +```json |
| 159 | +{ |
| 160 | + "resource": "wordpress.org/plugins", |
| 161 | + "slug": "akismet" |
| 162 | +} |
| 163 | +``` |
| 164 | + |
| 165 | +### VFS リファレンス |
| 166 | + |
| 167 | +<!-- |
| 168 | +### VFSReference |
| 169 | +--> |
| 170 | + |
| 171 | +_VFSReference_ リソースは、仮想ファイルシステム (VFS) に格納されているファイルを参照するために使用されます。VFS はメモリに格納されるファイルシステムであり、オペレーティングシステムのファイルシステムに含まれないファイルを格納できます。_VFSReference_ リソースは次のように定義されています。 |
| 172 | + |
| 173 | +<!-- |
| 174 | +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: |
| 175 | +--> |
| 176 | + |
| 177 | +```typescript |
| 178 | +type VFSReference = { |
| 179 | + resource: 'vfs'; |
| 180 | + path: string; |
| 181 | +}; |
| 182 | +``` |
| 183 | + |
| 184 | +_VFSReference_ リソースを使用するには、VFS 内のファイルへのパスを指定する必要があります。例えば、VFS のルートに保存されている「index.html」という名前のファイルを参照するには、次のように _VFSReference_ を作成します。 |
| 185 | + |
| 186 | +<!-- |
| 187 | +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: |
| 188 | +--> |
| 189 | + |
| 190 | +```json |
| 191 | +{ |
| 192 | + "resource": "vfs", |
| 193 | + "path": "/index.html" |
| 194 | +} |
| 195 | +``` |
| 196 | + |
| 197 | +### リテラル参照 |
| 198 | + |
| 199 | +<!-- |
| 200 | +### LiteralReference |
| 201 | +--> |
| 202 | + |
| 203 | +_LiteralReference_ リソースは、コード内でリテラルとして保存されているファイルを参照するために使用されます。_LiteralReference_ リソースは次のように定義されます。 |
| 204 | + |
| 205 | +<!-- |
| 206 | +The _LiteralReference_ resource is used to reference files that are stored as literals in the code. The _LiteralReference_ resource is defined as follows: |
| 207 | +--> |
| 208 | + |
| 209 | +```typescript |
| 210 | +type LiteralReference = { |
| 211 | + resource: 'literal'; |
| 212 | + name: string; |
| 213 | + contents: string | Uint8Array; |
| 214 | +}; |
| 215 | +``` |
| 216 | + |
| 217 | +_LiteralReference_ リソースを使用するには、ファイル名とその内容を指定する必要があります。例えば、「Hello, World!」というテキストを含む「index.html」という名前のファイルを参照するには、次のように _LiteralReference_ を作成します。 |
| 218 | + |
| 219 | +<!-- |
| 220 | +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: |
| 221 | +--> |
| 222 | + |
| 223 | +```json |
| 224 | +{ |
| 225 | + "resource": "literal", |
| 226 | + "name": "index.html", |
| 227 | + "contents": "Hello, World!" |
| 228 | +} |
| 229 | +``` |
| 230 | + |
| 231 | +### バンドルリファレンス |
| 232 | + |
| 233 | +<!-- |
| 234 | +### BundledReference |
| 235 | +--> |
| 236 | + |
| 237 | +`BundledReference` リソースは、ブループリント自体にバンドルされているファイルを参照するために使用されます。これは、必要なリソースをすべて含む自己完結型のブループリントバンドルを作成する場合に特に便利です。`BundledReference` リソースは次のように定義されます。 |
| 238 | + |
| 239 | +<!-- |
| 240 | +The `BundledReference` resource is used to reference files that are bundled with the Blueprint itself. This is particularly useful for creating self-contained Blueprint bundles that include all necessary resources. The `BundledReference` resource is defined as follows: |
| 241 | +--> |
| 242 | + |
| 243 | +```typescript |
| 244 | +type BundledReference = { |
| 245 | + resource: 'bundled'; |
| 246 | + path: string; |
| 247 | +}; |
| 248 | +``` |
| 249 | + |
| 250 | +`BundledReference` リソースを使用するには、バンドル内のファイルへの相対パスを指定する必要があります。例えば、ブループリントにバンドルされている「plugin.php」というファイルを参照するには、次のように `BundledReference` を作成します。 |
| 251 | + |
| 252 | +<!-- |
| 253 | +To use the `BundledReference` resource, you need to provide the relative path to the file within the bundle. For example, to reference a file named "plugin.php" that is bundled with the Blueprint, you can create a `BundledReference` as follows: |
| 254 | +--> |
| 255 | + |
| 256 | +```json |
| 257 | +{ |
| 258 | + "resource": "bundled", |
| 259 | + "path": "plugin.php" |
| 260 | +} |
| 261 | +``` |
| 262 | + |
| 263 | +ブループリント バンドルは、次のようなさまざまな形式で配布できます。 |
| 264 | + |
| 265 | +<!-- |
| 266 | +Blueprint bundles can be distributed in various formats, including: |
| 267 | +--> |
| 268 | + |
| 269 | +- トップレベルに `blueprint.json` ファイルを含む ZIP ファイル |
| 270 | +- `blueprint.json` ファイルと関連リソースを含むディレクトリ |
| 271 | +- ブループリントとそのリソースが一緒にホストされているリモート URL |
| 272 | + |
| 273 | +<!-- |
| 274 | +- ZIP files with a top-level `blueprint.json` file |
| 275 | +- Directories containing a `blueprint.json` file and related resources |
| 276 | +- Remote URLs where the Blueprint and its resources are hosted together |
| 277 | +--> |
| 278 | + |
| 279 | +ブループリント バンドルの詳細については、[ブループリント バンドル](/blueprints/bundles) ドキュメントを参照してください。 |
| 280 | + |
| 281 | +<!-- |
| 282 | +For more information on Blueprint bundles, see the [Blueprint Bundles](/blueprints/bundles) documentation. |
| 283 | +--> |
0 commit comments