Skip to content
This repository has been archived by the owner on May 6, 2019. It is now read-only.

mdreizin/gatsby-plugin-postcss

Repository files navigation

NPM version Travis build status AppVeyor build status Maintainability Test Coverage Dependency Status Development Dependency Status

gatsby-plugin-postcss

Gatsby plugin to handle PostCSS.

Install

yarn add gatsby-plugin-postcss

or

npm install --save gatsby-plugin-postcss

How to Use

gatsby-config.js

module.exports = {
  plugins: ['gatsby-plugin-postcss']
};

This plugin uses postcss-loader with its default options that means you can use your own postcss.config.js:

postcss.config.js

const postcssPresetEnv = require('postcss-preset-env');

module.exports = () => ({
  plugins: [
    postcssPresetEnv({
      stage: 0
    })
  ]
});

Options

You can use any allowed postcss-loader options using postcss property:

gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-postcss',
      options: {
        postcss: {
          plugins: () => [require('postcss-preset-env')({ stage: 0 })]
        }
      }
    }
  ]
};