WePY 使用less autoprefix

最近發現在部份機型上使用display: flex;會出現兼容性問題,經測試發現與prefix有關。

使用less時,建議加上autoprefix插件,步驟如下:

  • 安裝插件
npm install less-plugin-autoprefix --save-dev
  • 配置插件
    在wepy.config.js中加入
const LessPluginAutoPrefix = require('less-plugin-autoprefix');

...
...

  compilers: {
    less: {
      compress: true,
      plugins: [new LessPluginAutoPrefix({browsers: ['Android >= 2.3', 'Chrome > 20', 'iOS >= 6']})]
    }

官網https://github.com/Tencent/wepy/wiki/WePY-%E4%BD%BF%E7%94%A8less-autoprefix

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章