-
Notifications
You must be signed in to change notification settings - Fork 414
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
fix(atomic): slugify keyframes and enable vendor prefix #992
Conversation
4e185fd
to
ffe3f5d
Compare
ffe3f5d
to
6725d24
Compare
6725d24
to
1f7f855
Compare
1f7f855
to
2e5dec7
Compare
@jpnelson @juanferreras, may I ask you to take a look at this PR? |
@Anber sure! sorry on the delay. There are 2 changes here that I think it'd be wise to split:
Between not supporting vendor prefixing in atomic, and forcing it without being able to disable – I think we might still prefer the latter or a more in-depth discussion (eg. if we should make it default to no vendor prefix and configurable to opt back in)
The main benefit of the current way is that you can define the import { css } from '@linaria/atomic';
const x = css`
@keyframes fade {
from { opacity: 0; }
to { opacity: 1; }
}
animation: fade 1s infinite;
`;
// note this could be on the same file or not
const y = css`
animation: fade 1s infinite;
`; I understand @hackwaly your current implementation would not support that 2nd animation declaration (it'd mangle it to a non-existing animation-name), and would instead always require repeating the I think unless we could support using the right |
This PR is just trying to make After I switched my project from Keyframe names defined in difference css`` with same name are collided. I must manage keyframe names with care. Otherwise only one keyframe of collided keyframes works. Maybe we can use some name convention to control whether a keyframe name should be mangled. Eg. About vendor prefix. I completely agree with what @juanferreras said. |
@juanferreras we ran into similar issues. But regarding the statement you quoted above, our team had a thought let say for the given example:
if someday the this issue wont just be limited to csaes when such things are integrated in the build pipeline. in a team of 30-40 developers, anyone could easily end up removing an unsed JS declaration. And hence they might accidentally cause production issues Therefore, I guess the implementation in this PR is somewhat critical. I completely agree with the comment on prefixer though, but I guess we should be taking these somewhere as a parameter in linaria config Please do let me know if I am missing a bigger picture here |
Sorry for the delay here too –
I agree with this thought too, I think that's the direction we should be going too.
I agree, I think the ideal solution would be that animation keyframe names are slugified, based on the hash of their contents (so, duplicates could possibly be removed if there are exact duplicates). So for this PR, I'd take out the vendor prefixing, and ideally also add some tests so we're on the same page about what the behavior is for keyframes. Thanks for adding this @hackwaly ! |
I'm sorry that I've back to |
Good to know, thank you! For the expense of it, do you mean the expense of
merging the atoms in cx? There's some optimization we could do there for
basic cases, like when classes are specified in the same file as they're
used (or even imported possibly), we could pre compute the result. We'd
still need the merging logic in cx for the dynamic cases though.
I'll make an issue here for that too, but I'm curious to know if it would
make a difference for your use case.
…On Thu, Jul 21, 2022, 8:10 AM 文宇祥 ***@***.***> wrote:
I'm sorry that I've back to linaria/core from linaric/atomic. The mainly
reason is cx for linaria/atomic is too expensive. I have no motivation on
this PR ever.
—
Reply to this email directly, view it on GitHub
<#992 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALSYDHU2LUX3STJYW7Q5ELVVFR7ZANCNFSM5Y7LQIZA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Motivation
Close #990
Summary
Test plan