LESS transition mixin with prefixes

我与影子孤独终老i 提交于 2019-11-28 02:20:17

Since Less version 2 you can use the autoprefix postprocessor plugin and the consensus is that you should use it for best practice.

The Less autoprefix plugin can be found at: https://github.com/less/less-plugin-autoprefix.

After installing the you can run:

echo "selector {transition: transform .5s ease-out;}" | lessc - --autoprefix="last 20 versions"

The preceding command outputs:

selector {
  -webkit-transition: -webkit-transform 0.5s ease-out;
     -moz-transition: -moz-transform 0.5s ease-out;
       -o-transition: -o-transform 0.5s ease-out;
          transition: transform 0.5s ease-out;
}

You should consider Graceful degredation and run the autoprefix plugin without any browser argument. (lessc --autoprefix). Then your output will look like that shown below:

selector {
  -webkit-transition: -webkit-transform 0.5s ease-out;
          transition: transform 0.5s ease-out;
}

Notice that you can not use the auto prefix plugin when using less.js to compile your Less code in the browser. For client side compiling you can use the -prefix-free library.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!