webpack中添加px2rem-loader

在buid->util.js

 


  

const px2remLoader = {
loader: 'px2rem-loader',
options: {
remUnit: 75
}
}

// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader,px2remLoader] : [cssLoader,px2remLoader]

if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}

 

var px2remLoader = {

    loader: 'px2rem-loader',

    options: {

      remUnit: 75

    }

  }

posted @ 2018-01-18 10:05  Sentiger  阅读(612)  评论(0编辑  收藏  举报