Skip to content

Commit

Permalink
Support custom config file path, close: #23 (#24)
Browse files Browse the repository at this point in the history
* Support custom config file path, close: /issues/23

* format example config as json

* v2.0.1
  • Loading branch information
leecade authored and Joseph A. Szczesniak committed Apr 5, 2019
1 parent 7df45db commit fac3a09
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -25,6 +25,26 @@ babel configuration:
}
```

With config:

```json
{
"plugins": [
["styled-jsx/babel", {
"plugins": [
[
"styled-jsx-plugin-postcss",
{
"path":
"[PATH_PREFIX]/postcss.config.js"
}
]
]
}]
]
}
```

### 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).
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -14,7 +14,7 @@ module.exports = (css, settings) => {
wait = false
}

processor(cssWithPlaceholders)
processor(cssWithPlaceholders, settings)
.then(resolved)
.catch(resolved)
loopWhile(() => wait)
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "styled-jsx-plugin-postcss",
"version": "2.0.0",
"version": "2.0.1",
"description": "Plugin to add PostCSS support to styled-jsx",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion processor.js
Expand Up @@ -9,7 +9,7 @@ function processor(src, options) {

let loaderPromise
if (!plugins) {
loaderPromise = loader(options.env || process.env, null, { argv: false })
loaderPromise = loader(options.env || process.env, options.path, { argv: false })
.then(pluginsInfo => {
plugins = pluginsInfo.plugins || []
})
Expand Down

0 comments on commit fac3a09

Please sign in to comment.