1.0.6 • Published 4 years ago
rem-webpack-plugin v1.0.6
npm i --save-dev rem-webpack-plugin yarn add --dev rem-webpack-plugin该插件依赖html-webpack-plugin。如未安装,请按照如下方式安装:
npm i --save-dev html-webpack-plugin yarn add --dev html-webpack-pluginwebpack.config.js
const RemWebpackPlugin = require('rem-webpack-plugin')
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'main.js'
},
plugins: [
new RemWebpackPlugin()
]
}
// width options
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'main.js'
},
plugins: [
new RemWebpackPlugin({
root: 50,
rootWidth: 375,
maxWidth: 600
})
]
}| Name | Type | Default | Description |
|---|---|---|---|
root | Number | 100 | 如果使用了px2rem等类似的插件,请保持root配置一致 |
rootWidth | Number | 750 | 页面基础宽度 |
maxWidth | Number | 750 | 最大宽度,超过最大宽度时根节点的fontsize值不变 |