Allow tooling authors to provide custom postcss factory through options#511
Conversation
Codecov Report
@@ Coverage Diff @@
## master #511 +/- ##
==========================================
+ Coverage 97.95% 97.96% +0.01%
==========================================
Files 5 5
Lines 244 246 +2
Branches 80 81 +1
==========================================
+ Hits 239 241 +2
Misses 5 5
Continue to review full report at Codecov.
|
alexander-akait
left a comment
There was a problem hiding this comment.
Can you provide example of usage? Do you want to use postcss@7 or postcss@8? Why not validate it on boilerplate side? In theory I can add this as the migration options (and when we drop postcss@7 support we remove it)
|
Currently, the way a user consumes Storybook looks (more-or-less) like: The internally-included However, a new option can be exposed that allows users to specify a custom postcss factory that has priority over the implicit dependency using this feature. So they would do: |
alexander-akait
left a comment
There was a problem hiding this comment.
Okay, let's rename customPostcss to implementation, we have the same option in sass-loader (https://github.com/webpack-contrib/sass-loader/blob/master/src/options.json#L4)
|
@alexander-akait great thought! I've updated to be more consistent with sass-loader. Do you have any recommendations for getting the snapshots to succeed consistently across node versions? |
| @@ -1,3 +1,4 @@ | |||
| // eslint-disable-next-line import/no-named-as-default, import/no-named-as-default-member | |||
There was a problem hiding this comment.
I think it is global eslint problem, we don't have this rules
| import { validate } from "schema-utils"; | ||
|
|
||
| import postcss from "postcss"; | ||
| import ourPostcss from "postcss"; |
There was a problem hiding this comment.
Let's return to postcss
There was a problem hiding this comment.
The problem I ran into was naming the local variable postcss too. I can change that and put this back to postcss
| ### `implementation` | ||
|
|
||
| Type: `Function` | ||
| Default: `undefined` |
There was a problem hiding this comment.
Let's remove Default from here, because we describe this below
|
Also can you accept CLA? |
|
@alexander-akait I addressed your comments and squashed the commits. I removed my package-lock updates and other things that made the tests pass locally for me, I think those should be fixed outside this feature. |
|
Thanks |

This PR contains a:
Motivation / Use-Case
Ref #510
I know @alexander-akait said it is out-of-scope, but I needed to write the code anyway. So I figured I'd make the code suitable to upstream and submit it anyway—under the assumption this will be closed.
I'll be publishing my fork as
@phated/postcss-loaderfor our use in Storybook until we can make the 7.0 breaking release—at which time, we'll be able to require users to rely on peerDeps and switch back to this upstream project.Cheers! 🚀
Breaking Changes
Additional Info