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

Enable hot reloading of imported stylesheets #400

Merged
merged 1 commit into from
Aug 24, 2016
Merged

Enable hot reloading of imported stylesheets #400

merged 1 commit into from
Aug 24, 2016

Conversation

andrewcoelho
Copy link
Contributor

Initializes postcss as a function with the wp argument
passed in. This allows to use the 'addDependencyTo' option
of postcss-import plugin so that hot reloading will work
properly with imported stylesheets.

Initializes postcss as a function with the wp argument
passed in. This allows to use the 'addDependencyTo' option
of postcss-import plugin so that hot reloading will work
properly with imported stylesheets.
@KyleAMathews
Copy link
Contributor

What exactly does this option do? It's only for enabling hot reloading? I just want to make sure I understand the implications of the change.

@andrewcoelho
Copy link
Contributor Author

It is only for enabling hot reloading.

When using css modules, this isn't necessary as each stylesheet is required directly.

However, when using a more traditional global stylesheet approach, where there is only one root level require which contains @import statements of other stylesheet partials, the only thing hot reloaded will be the root level stylesheet.

By adding the dependency to webpack in the postcss-import plugin, it allows stylesheet partials which are @imported to be hot reloaded as well.

https://github.com/postcss/postcss-import/blob/master/README.md#adddependencyto

@KyleAMathews
Copy link
Contributor

Thanks for the explanation! Sounds like a winner of a change.

@KyleAMathews KyleAMathews merged commit 89d05f2 into gatsbyjs:master Aug 24, 2016
@jlengstorf
Copy link
Contributor

Hiya @andrewcoelho! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants