wepy 編譯less添加css前綴(autoprefix)

wepy 編譯less添加css前綴(autoprefix)

wepy、autoprefix

wepy的編譯默認是沒有css autoprefix,所以就有樣式兼容性的問題了;

需要手動去添加配置,如下:

1.安裝

執行

npm install less-plugin-autoprefix save

2.配置

wepy.config.js中,

先導入LessPluginAutoPrefix插件,然後添加配置即可

// css前綴
const LessPluginAutoPrefix = require('less-plugin-autoprefix');
// ...
// ...
module.exports = {
 compilers: {
        less: {
            compress: prod,
            // less編譯配置,添加LessPluginAutoPrefix插件
            plugins: [new LessPluginAutoPrefix({ browsers: ['Android >= 2.3', 'Chrome > 20', 'iOS >= 6'] 				   
            })]
        },
  };
  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章