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']
})]
},
};