Usage of css helper function
See original GitHub issueBased on a conversation over at https://github.com/styled-components/vim-styled-components/pull/30 I wanted to talk a bit about the purpose of the css
helper mixin.
The current documentation states
css A helper function to generate CSS from a template literal with interpolations. You need to use this if you return a template literal with interpolations inside an interpolation. (This is due to how tagged template literals work)
If you’re just returning a normal string you do not need to use this.
Based on the conversation generated in the above PR it seems this description is no longer accurate? And the css
helper is intended to be used whenever the user breaks out of an interpolation.
This feels like a sledgehammer solution to the problem when education would be more beneficial.
I feel that the current documentation does a very good job of describing the appropriate use case for the css
helper and that the informed developer knows when it’s needed vs. when returning a plain string is acceptable.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
You are on the right track here. Unfortunately we won’t be targeting custom tagged template literals. Maybe we will at some point but for now it seems unlikely.
A future proof implementation would involve turning the input for such a media helper into:
media.large(css``)
for instanceI’m sure you could also work on a codemod when the time comes. We are just a couple of people with a lot of foundational work to be done until more can start to help and accelerate work on v3
Closing since there’s nothing actionable for us to do here, thanks for forcing us to clarify @Jmeyering!