今天同事遇到个问题,在本地运行没问题,打包后-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