I've come across a potential bug when using injectGlobal; I may be using it incorrectly, as it is flagged as an escape hatch in the documentation.
I declare my global styles in seperate files which I then import and pass to injectGlobal.
When I declare ONE tagged template variable and pass it into injectGlobal my JS variable doesn't apply.
However when I declare TWO tagged template variables (one template having variables the other just plain text) and pass them both into injectGlobal my JS variable does apply.
I have two examples linked below on Codepen.
2.0.0
https://codepen.io/peteph_am/pen/MmNLPY
https://codepen.io/peteph_am/pen/dWxaQV
injectGlobalJS variables should work in tagged template literals when not passed directly to injectGlobal.
JS variables don't work in tagged template literals when not passed directly to injectGlobal, unless passing multiple tagged template literals.
You need to call injectGlobal as a tagged template string and not as a function.
styled.injectGlobal`${reset} ${base}`
Should work fine this way.
Most helpful comment
You need to call injectGlobal as a tagged template string and not as a function.
Should work fine this way.