LoginSignup
0
0

More than 1 year has passed since last update.

PostCSS で animation の keyframe 名に `:local` が入る

Posted at

React (Next.js)で開発していて、CSS ファイルで animation の指定を行ったが反映されずに悩んだ。

結論としては、併用していた PostCSS のプラグインの中に悪さしているものがありそう(詳しく検証はしていない)。animation のプロパティを書く順番によって、:local が埋め込まれることがあるようだ。

keyframe 名を一番最初に持ってくることで解決する。

@keyframes spinner {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

// これは動かない
animation: 1s infinite alternate spinner;
// => animation: 1s infinite alternate :local(spinner)

// これは動く
animation: spinner 1s infinite alternate;

久々にくだらない罠にハマった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0