Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/docs/using-a-plugin-in-your-site.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
---
title: Using a Plugin in Your Site
title: サイトでプラグインを利用する
---

Gatsby plugins are Node.js packages, so you can install them like other packages in node using NPM.
Gatsby プラグインは、Node.js のパッケージです。 NPM を利用して他の node パッケージと同様にインストールできます。

For example, `gatsby-transformer-json` is a package that adds support for JSON files to the Gatsby data layer.
例えば、`gatsby-transformer-json` JSON ファイルのサポートを Gatsby データレイヤーに追加するパッケージです。

To install it, in the root of your site you run:
インストールするには、サイトのルートディレクトリーで下記のコマンドを実行します。

```shell
npm install --save gatsby-transformer-json
```

Then in your site's `gatsby-config.js` you add `gatsby-transformer-json` to the plugins array like:
次にサイトの `gatsby-config.js` にある plugins というキーの配列に `gatsby-transformer-json` を追加します。

```javascript:title=gatsby-config.js
module.exports = {
plugins: [`gatsby-transformer-json`],
}
```

Plugins can take options. For example:
プラグインは以下のようにしてオプションを受け取ることができます。

```javascript:title=gatsby-config.js
module.exports = {
plugins: [
// Shortcut for adding plugins without options.
// オプションなしでプラグインを追加するためのショートカット
"gatsby-plugin-react-helmet",
{
// Standard plugin with options example
// オプション付きで標準的なプラグインを追加するための例
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/data/`,
Expand All @@ -37,20 +37,20 @@ module.exports = {
},
{
resolve: "gatsby-plugin-offline",
// Blank options, equivalent to string-only plugin
// options が空の場合、文字列だけでプラグインを指定したときと同等です
options: {
plugins: [],
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
// plugins inside plugins
// プラグイン内のプラグイン
plugins: [`gatsby-remark-smartypants`],
},
},
],
}
```

Note that plugin options will be stringified by Gatsby, so they cannot be functions.
プラグインのオプションは Gatsby によって文字列化されるため、関数にすることはできません。