Gatsby plugin to handle PostCSS.
yarn add gatsby-plugin-postcss
or
npm install --save gatsby-plugin-postcss
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
})
]
});
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 })]
}
}
}
]
};