Skip to content

Commit

Permalink
Merge pull request #18 from NukaPunk/master
Browse files Browse the repository at this point in the history
Removed postcss.config.js and updated readme
  • Loading branch information
Joseph A. Szczesniak committed Oct 16, 2018
2 parents 93c872c + 1534e46 commit d058bb9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .npmignore
@@ -0,0 +1,3 @@
postcss.config.js
test.js
fixture.css
38 changes: 34 additions & 4 deletions README.md
Expand Up @@ -8,10 +8,12 @@ Use [PostCSS](https://github.com/postcss/postcss) with

## Usage

Install the package first.
_Note that Next.js supports PostCSS out of the box, so you do not need this plug-in is using Next_.

Install this package and also `styled-jsx` first.

```bash
npm install --save styled-jsx-plugin-postcss
npm install --save styled-jsx styled-jsx-plugin-postcss
```

Next, add `styled-jsx-plugin-postcss` to the `styled-jsx`'s `plugins` in your
Expand All @@ -25,6 +27,33 @@ babel configuration:
}
```

### Example with CRA

Usage with Create React App requires you to either _eject_ or use [react-app-rewired](https://github.com/timarney/react-app-rewired).

Here is an example using `react-app-rewired`:

```javascript
// config-overrides.js
// this file overrides the CRA webpack.config

const { getBabelLoader } = require('react-app-rewired')

module.exports = function override (config, env) {
const loader = getBabelLoader(config.module.rules)

// Older versions of webpack have `plugins` on `loader.query` instead of `loader.options`.
const options = loader.options || loader.query
options.plugins = [['styled-jsx/babel', {
'plugins': ['styled-jsx-plugin-postcss']
}]].concat(options.plugins || [])
return config
}
```

_Note: Please follow their instructions on how to set up build & test scripts, and make sure you have a correctly formatted `postcss.config.js` as well_.


#### Notes

`styled-jsx-plugin-postcss` uses `styled-jsx`'s plugin system which is supported
Expand All @@ -39,8 +68,9 @@ therefore you may want to refer to their docs to learn more about

## Contributions

Although a _Proof Of Concept_ plugin, **PRs and contributions are welcome!** We
aim to drive development of this plugin through community contributions.
**PRs and contributions are welcome!**

We aim to drive development of this plugin through community contributions.

## License

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "styled-jsx-plugin-postcss",
"version": "1.0.0",
"version": "1.0.1",
"description": "Plugin to add PostCSS support to styled-jsx",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d058bb9

Please sign in to comment.