cssinjs / cssinjs/jss

jss-vendor-prefixer replaces animation: ['$spinner rotation'] on server but not client (has repro repository)

Open
#1,337 4 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

As mentioned in #1334

__Expected behavior:__
I have these styles. I don't know if arrays in animation are supported, but I expect it to either work on both the client and server, or fail on both the client server.
```
const styles = {
'@keyframes spinner-rotation': {
from: {transform: 'rotate(0deg)'},
to: {transform: 'rotate(360deg)'},
},
spinner: {
animation: [
'$spinner-rotation linear infinite 1s',
],
},
}
```

__Describe the bug:__
On the server it converts the animation name:
```
animation: keyframes-spinner-rotation-0-2-1 linear infinite 1s;
```
On the client it doesn't:
```
animation: $spinner-rotation linear infinite 1s;
```

__Codesandbox link:__
Can't use code sandbox because I have to demonstrate output on the server side.
I made a repo to demonstrate: https://github.com/jedwards1211/jss-plugin-vendor-prefixer-issue
Just run
```sh
git clone https://github.com/jedwards1211/jss-plugin-vendor-prefixer-issue
cd jss-plugin-vendor-prefixer-issue
npm i
npm start
```

__Versions (please complete the following information):__
- jss: 10.1.1
- Browser [e.g. chrome, safari]: Chrome 80.0.3987.163
- OS [e.g. Windows, macOS]: macOS 10.15.3

Contributor guide

Open the contributing guide

Research direction

Clone the linked reproduction repository and run npm i followed by npm start to observe the server and client output. Compare the handling of the animation array containing $spinner-rotation in the JSS vendor-prefixer path. Done means the animation name is handled consistently on both server and client, or fails consistently on both.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.