-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
New: Add hot module reloading for theme and styles #1489
Conversation
I thought that I could find a simple way to decouple components from the styles and themes object. I could not without big changes to the To have Webpack recompile each component's style independently (and therefore hot replace only the components impacted) the requests to the This is too big of a change for what I want for this PR. I will come up with another one. This one is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👾
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And there are a few unresolved comments from the previous iteration.
Finally done all the last fixes, we should be closer to the finish line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still couple of open comments in styleguide-loader.ts
, the rest looks good!
@sapegin I did it all now, finally, I am open to questions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sapegin is this comment better ?
@sapegin do you think I can merge this one? |
Yup, go for it! |
🎉 This PR is included in version 10.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
closes #1475
This Pull Request allows users of
react-styleguidist
to iterate faster with the styling of their guides.It avoids having to stop and restart the webpack-dev-server every time a change is made to the theme or the styles.
To achieve this goal, I allow the
styles
andtheme
parameters to be passed as File paths instead of an object. Webpack can then use the new files as modules and hot replace them.themed
exampleschema/config.ts
styleguide-loader.ts
to resolve the style files usingrequireIt
and set them up for hmr using adddependency and thehmrStyles
flagclient/index.ts
to resolve es6 & es5 exports of style files and pass them on torenderStyleguide
cssRevision
to force its refresh and recalc the stylescreateStyleSheet
memoization when styles havechanged