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

fix(gatsby-plugin-postcss): Always ensure postcss.config.js is loaded #16521

Merged
merged 3 commits into from
Aug 13, 2019
Merged

fix(gatsby-plugin-postcss): Always ensure postcss.config.js is loaded #16521

merged 3 commits into from
Aug 13, 2019

Conversation

mdreizin
Copy link
Contributor

Description

If you specify cssLoaderOptions then postcss-loader wound not picked up postcss.config.js config.

The postcssOptions options would contain cssLoaderOptions property ({cssLoaderOptions: {...}}) and postcss-loader gets it as is and does not use some built-in defaults.

This PR aims to fix that and also add some code-style adjustments to align with existing codebase.

Related Issues

#10861

@mdreizin mdreizin requested a review from a team as a code owner August 10, 2019 20:02
@mdreizin mdreizin self-assigned this Aug 10, 2019
@mdreizin mdreizin changed the title fix(gatsby-plugin-postcss): Fix regression introduced by #10861 fix(gatsby-plugin-postcss): Fix loading of "postcss.config.js" config Aug 10, 2019
Copy link
Contributor

@sidharthachatterjee sidharthachatterjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this! Could you please add a test that asserts the correct behaviour here so that we don't see regressions in the future?

@mdreizin
Copy link
Contributor Author

Thank you for fixing this! Could you please add a test that asserts the correct behaviour here so that we don't see regressions in the future?

Yes, I could. I will do my best to add missing tests this week.

@pieh
Copy link
Contributor

pieh commented Aug 13, 2019

Hey @mdreizin! Do you think you will have time to take a look at those tests? If not - that's not a problem - I can add test case for cssLoaderOptions. If you want to do this, but have any questions - don't hesitate to ask!

@mdreizin
Copy link
Contributor Author

mdreizin commented Aug 13, 2019

@pieh No, I don’t. I will be able to write them only at the weekend. It would be nice if you could add missing tests.

@pieh pieh self-assigned this Aug 13, 2019
@sidharthachatterjee
Copy link
Contributor

Thanks for the tests @pieh 💜

@sidharthachatterjee sidharthachatterjee changed the title fix(gatsby-plugin-postcss): Fix loading of "postcss.config.js" config fix(gatsby-plugin-postcss): Always ensure postcss.config.js is loaded Aug 13, 2019
@sidharthachatterjee sidharthachatterjee added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Aug 13, 2019
@pieh
Copy link
Contributor

pieh commented Aug 13, 2019

Diff for snapshot file is messy, mostly because we didn't reset mocked calls before.

Here's somewhat easier to see snapshot diff between master and this PR - https://gist.github.com/pieh/6ee5420e34bd61ca36d4392cbd64171c

@gatsbybot gatsbybot merged commit 14179b0 into gatsbyjs:master Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants