evrone / postcss-px-to-viewport

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.
https://evrone.com/postcss-px-viewport
MIT License
3.04k stars 406 forks source link

`keyframes` are not converted #34

Closed gulewei closed 5 years ago

gulewei commented 5 years ago

px unit in @keyframes are not converted unless I config mediaQuery as true, is this a bug or something? I didn't found anything about this in doc.

my postcss.config.js :

module.exports = {
    plugins: [
        require('autoprefixer'),
        require('postcss-px-to-viewport')({
            viewportWidth: 750,
            // mediaQuery: true,
        })
    ]
};

my css :

@keyframes testmove {
    0%{
        top:100px;
    }
    100%{
        top:200px;
    }
}

and it turns to :

@keyframes testmove {
  0% {
    top: 100px;
  }
  100% {
    top: 200px;
  }
}
KODerFunk commented 5 years ago

@venecy Thanks for the report! Of course, mediaQuery option should only affect media-queries. I think for @keyframes not need options, just configure it to convert according to the rules of the context. Right?

zangbianxuegu commented 4 months ago

@venecy Thanks for the report! Of course, mediaQuery option should only affect media-queries. I think for @keyframes not need options, just configure it to convert according to the rules of the context. Right?

I don’t undestand, mediaQuery option should only affect media-queries. but it would affect @keyframes, When set mediaQuery false as default,@keyframes rule won’t convert, why? And what does 'configure it to convert according to the rules of the context' mean? Thanks!