Skip to content

Add static build flag #208

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yepitschunked
Copy link

To facilitate build-time styles extraction, it would be helpful to add an env or global variable that tells withStyles to create the stylesheet immediately, rather than waiting for the component to be rendered.

This would make things like https://github.com/airbnb/react-dates/blob/master/scripts/renderAllComponents.jsx simpler; rather than having to actually render a bunch of components (and dealing with passing down correct props), just require them.

@yepitschunked
Copy link
Author

yepitschunked commented Feb 22, 2019

I'm not sure how to handle direction here. Maybe we should generate for both? But I'm afraid that will result in a lot of redundant styles.

@ljharb
Copy link
Collaborator

ljharb commented Feb 24, 2019

https://github.com/airbnb/react-dates/blob/master/scripts/renderAllComponents.jsx is still meant to actually render them all, so I don't think it would impact those.

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Perhaps instead of an env var, this could be done with React context?

@yepitschunked
Copy link
Author

Perhaps instead of an env var, this could be done with React context?

@ljharb My goal was to have the styles generated as soon as the withStyles block is run, rather than having to render/be involved with React in any way.

@ljharb
Copy link
Collaborator

ljharb commented Feb 25, 2019

Hmm - I wonder if, instead of an env var, we could call an API method on r-w-s to set a flag?

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

Successfully merging this pull request may close these issues.

2 participants