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
26 changes: 13 additions & 13 deletions docs/docs/post-css.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
title: PostCSS
---

PostCSS transforms extended syntaxes and features into modern, browser-friendly CSS. This guide will show you how to get started with Gatsby and PostCSS.
PostCSS は拡張した構文と機能を、モダンで、ブラウザフレンドリーな CSS に変換します。このガイドでは、Gatsby PostCSS をはじめる方法を紹介します。

## Installing and configuring PostCSS
## PostCSS のインストールと設定

This guide assumes that you have a Gatsby project set up. If you need to set up a project, head to the [quick start guide](/docs/quick-start/), then come back.
このガイドは Gatsby プロジェクトがセットアップされていることを前提としています。プロジェクトをセットアップする必要がある場合、[クイックスタートガイド](/docs/quick-start/)を参照してください。

1. Install the Gatsby plugin [gatsby-plugin-postcss](/packages/gatsby-plugin-postcss/).
1. Gatsby プラグイン [gatsby-plugin-postcss](/packages/gatsby-plugin-postcss/) をインストールします。

```shell
npm install --save gatsby-plugin-postcss
```

2. Include the plugin in your `gatsby-config.js` file.
2. `gatsby-config.js` ファイルにプラグインを追加します。

```javascript:title=gatsby-config.js
plugins: [`gatsby-plugin-postcss`],
```

> **Note**: If you need to pass options to PostCSS use the plugins options; see [postcss-loader](https://github.com/postcss/postcss-loader) for all available options.
> **ヒント**: PostCSS にオプションを渡したい場合は、プラグインオプションの中で設定します。設定可能な全てのオプションは [postcss-loader](https://github.com/postcss/postcss-loader) にて確認できます。

3. Write your stylesheets using PostCSS (`.css` files) and require or import them as normal.
3. PostCSS`.css` ファイル)にスタイルシートを記述し、通常通り require あるいは import してください。

```css:title=styles.css
@custom-media --med (width <= 50rem);
Expand All @@ -40,13 +40,13 @@ plugins: [`gatsby-plugin-postcss`],
import "./styles.css"
```

### With CSS modules
### CSS modules と併用する

Using CSS modules requires no additional configuration. Simply prepend `.module` to the extension. For example: `App.css -> App.module.css`. Any file with the module extension will use CSS modules.
CSS モジュールを使用するための追加設定は不要です。拡張子に `.module` を追加するだけです。例:`App.css -> App.module.css`module 拡張子を持つファイルは CSS モジュールとして処理されます。

### PostCSS plugins
### PostCSS プラグイン

If you would prefer to add additional postprocessing to your PostCSS output you can specify plugins in the plugin options:
PostCSS 出力に追加の後処理を行うプラグインを追加したい場合、プラグインオプションの中で設定可能です:

```javascript:title=gatsby-config.js
plugins: [
Expand All @@ -59,7 +59,7 @@ plugins: [
],
```

Alternatively, you can use `postcss.config.js` to specify your particular PostCSS configuration:
あるいは、`postcss.config.js` で追加したい PostCSS プラグインを設定可能です:

```javascript:title=postcss.config.js
const postcssPresetEnv = require(`postcss-preset-env`)
Expand All @@ -73,6 +73,6 @@ module.exports = () => ({
})
```

## Other resources
## その他の資料

- [Introduction to postcss](https://www.smashingmagazine.com/2015/12/introduction-to-postcss/)