Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-plugin-postcss #6217

Merged
merged 23 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions packages/gatsby-plugin-postcss/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
["../../.babel-preset.js"]
]
}
1 change: 1 addition & 0 deletions packages/gatsby-plugin-postcss/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/gatsby-node.js
34 changes: 34 additions & 0 deletions packages/gatsby-plugin-postcss/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
*.un~
yarn.lock
src
flow-typed
coverage
decls
examples
56 changes: 56 additions & 0 deletions packages/gatsby-plugin-postcss/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# gatsby-plugin-postcss

Gatsby plugin to handle PostCSS.

## Install

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

## How to use

1. Include the plugin in your `gatsby-config.js` file:

`gatsby-config.js`

```js
module.exports = {
plugins: ["gatsby-plugin-postcss"],
}
```

2. Create your own `postcss.config.js`:

`postcss.config.js`

```js
const postcssPresetEnv = require(`postcss-preset-env`)

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

## Options

You can use any allowed [`postcss-loader`](https://github.com/postcss/postcss-loader#options) options using `postcss` property:

`gatsby-config.js`

```js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-postcss`,
options: {
postcss: {
plugins: () => [require(`postcss-preset-env`)({ stage: 0 })],
},
},
},
],
}
```
1 change: 1 addition & 0 deletions packages/gatsby-plugin-postcss/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop
36 changes: 36 additions & 0 deletions packages/gatsby-plugin-postcss/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "gatsby-plugin-postcss",
"description": "Gatsby plugin to handle PostCSS",
"version": "2.0.0-beta.1",
"author": "Marat Dreizin <[email protected]>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"dependencies": {
"@babel/runtime": "7.0.0-beta.51",
"postcss-loader": "^2.1.3"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.51",
"@babel/core": "7.0.0-beta.51",
"cross-env": "^5.1.4"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-postcss#readme",
"keywords": [
"gatsby",
"gatsby-plugin",
"postcss"
],
"license": "MIT",
"main": "index.js",
"peerDependencies": {
"gatsby": ">2.0.0-alpha"
},
"readme": "README.md",
"repository": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-postcss",
"scripts": {
"build": "babel src --out-dir . --ignore **/__tests__",
"prepare": "cross-env NODE_ENV=production npm run build",
"watch": "babel -w src --out-dir . --ignore **/__tests__"
}
}
5 changes: 5 additions & 0 deletions packages/gatsby-plugin-postcss/src/__tests__/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"jest": true
}
}
Loading