12345678910111213141516171819202122232425262728 |
- 1.安装px2rem
- npm install px2rem-loader --save-dev
- 2.安装lib-flexible
- npm install lib-flexible --save-dev
- 3.全局引入lib-flexibe
- import 'lib-flexible/flexible'
- 4.build utils.js配置转换率
- var px2remLoader = {
- loader: 'px2rem-loader',
- options: {
- remUnit: 136.6 //设计稿宽度/10
- }
- };
- // generate loader string to be used with extract text plugin
- function generateLoaders(loader, loaderOptions) {
- var loaders = [cssLoader, px2remLoader]; //添加px2rem 插件
- if (loader) {
- loaders.push({
- loader: loader + '-loader',
- options: Object.assign({}, loaderOptions, {
- sourceMap: options.sourceMap
- })
- })
- }
|