今天同事遇到個問題,在本地運行沒問題,打包後-webkit-box-orient屬性丟失了,因而我倆就開始實驗。
通過一頓子猛操做,改爲行內樣式(可能只適用於咱們的項目),就能夠了。css
而後重點來了,過後我搜索了一波,想了解下緣由,過後!過後!發覺解決方法挺多的,我暈(太真實了)。有必要記錄一下:
緣由:autoprefixer自動移除老式過期的代碼。
webpack
方案1:web
/* autoprefixer: ignore next */
-webkit-box-orient: vertical;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
/* autoprefixer: on */
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
new OptimizeCSSPlugin({
cssProcessorOptions: {
safe: true, map: { inline: false },
autoprefixer: { remove: false } //添加對autoprefixer的配置ui
}
})
spa
緣由不一樣,方法不一樣,試就完事,若是你想,行內樣式你也能夠試試。code