Skip to content

Make possible to initialize SC_ATTR via REACT_APP_SC_ATTR env variable#2501

Merged
quantizor merged 6 commits intostyled-components:masterfrom
oliverlaz:react_app_sc_attr
Jun 4, 2019
Merged

Make possible to initialize SC_ATTR via REACT_APP_SC_ATTR env variable#2501
quantizor merged 6 commits intostyled-components:masterfrom
oliverlaz:react_app_sc_attr

Conversation

@oliverlaz
Copy link
Contributor

When working with two or more different styled-components instances on a single page (or application), SC_ATTR environment variable could be used for distinguishing between those instances.

However, in create-react-app based applications, environment variables are filtered out by matching them with a well-known pattern (REACT_APP_) -> see here.

This PR enables usage of REACT_APP_SC_ATTR environment variable as a fallback and its easier configuration via a .env file.

@quantizor
Copy link
Contributor

Can you add this for the other env variable too? SC_DISABLE_SPEEDY

@oliverlaz
Copy link
Contributor Author

Sure! PR is updated.

@quantizor quantizor added the 4.0 label May 29, 2019
@quantizor
Copy link
Contributor

@oliverlaz can you look into the CI failure?

@oliverlaz
Copy link
Contributor Author

Hey @probablyup, Somehow this DISABLE_SPEEDY flag messes up the integration test.
At first, I just thought it is a Travis issue but later I managed to reproduce it on my side as well (integration test suite requires a built version of styled-components).
I will ping you back once I find the culprit.

oliverlaz and others added 6 commits June 4, 2019 11:20
this increases the compatibility with CRA as it filters out any env
variables which don't follow the REACT_APP_* pattern
…Y env variable

this increases the compatibility with CRA as it filters out any env
variables which don't follow the REACT_APP_* pattern
@quantizor quantizor force-pushed the react_app_sc_attr branch from 911b25d to a3519cd Compare June 4, 2019 16:30
@quantizor quantizor merged commit 4ca4e62 into styled-components:master Jun 4, 2019
quantizor added a commit that referenced this pull request Jun 4, 2019
quantizor added a commit that referenced this pull request Nov 7, 2019
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