11---
2- title : Using a Plugin in Your Site
2+ title : サイトでプラグインを利用する
33---
44
5- Gatsby plugins are Node.js packages, so you can install them like other packages in node using NPM.
5+ Gatsby プラグインは、 Node.js のパッケージです。 NPM を利用して他の node パッケージと同様にインストールできます。
66
7- For example, ` gatsby-transformer-json ` is a package that adds support for JSON files to the Gatsby data layer.
7+ 例えば、 ` gatsby-transformer-json ` は JSON ファイルのサポートを Gatsby データレイヤーに追加するパッケージです。
88
9- To install it, in the root of your site you run:
9+ インストールするには、サイトのルートディレクトリーで下記のコマンドを実行します。
1010
1111``` shell
1212npm install --save gatsby-transformer-json
1313```
1414
15- Then in your site's ` gatsby-config.js ` you add ` gatsby-transformer-json ` to the plugins array like:
15+ 次にサイトの ` gatsby-config.js ` にある plugins というキーの配列に ` gatsby-transformer-json ` を追加します。
1616
1717``` javascript:title=gatsby-config.js
1818module .exports = {
1919 plugins: [` gatsby-transformer-json` ],
2020}
2121```
2222
23- Plugins can take options. For example:
23+ プラグインは以下のようにしてオプションを受け取ることができます。
2424
2525``` javascript:title=gatsby-config.js
2626module .exports = {
2727 plugins: [
28- // Shortcut for adding plugins without options.
28+ // オプションなしでプラグインを追加するためのショートカット
2929 " gatsby-plugin-react-helmet" ,
3030 {
31- // Standard plugin with options example
31+ // オプション付きで標準的なプラグインを追加するための例
3232 resolve: ` gatsby-source-filesystem` ,
3333 options: {
3434 path: ` ${ __dirname } /src/data/` ,
@@ -37,20 +37,20 @@ module.exports = {
3737 },
3838 {
3939 resolve: " gatsby-plugin-offline" ,
40- // Blank options, equivalent to string-only plugin
40+ // options が空の場合、文字列だけでプラグインを指定したときと同等です
4141 options: {
4242 plugins: [],
4343 },
4444 },
4545 {
4646 resolve: ` gatsby-transformer-remark` ,
4747 options: {
48- // plugins inside plugins
48+ // プラグイン内のプラグイン
4949 plugins: [` gatsby-remark-smartypants` ],
5050 },
5151 },
5252 ],
5353}
5454```
5555
56- Note that plugin options will be stringified by Gatsby, so they cannot be functions.
56+ プラグインのオプションは Gatsby によって文字列化されるため、関数にすることはできません。
0 commit comments