rem-webpack-plugin

1.0.6 • Public • Published

Rem Webpack Plugin

NPM NPM

一款向html中插入rem自适应脚本的插件

Install

  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-plugin

Usage

webpack.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
    })
  ]
}

Options

Name Type Default Description
root Number 100 如果使用了px2rem等类似的插件,请保持root配置一致
rootWidth Number 750 页面基础宽度
maxWidth Number 750 最大宽度,超过最大宽度时根节点的fontsize值不变

Readme

Keywords

Package Sidebar

Install

npm i rem-webpack-plugin

Weekly Downloads

1

Version

1.0.6

License

ISC

Unpacked Size

5.06 kB

Total Files

4

Last publish

Collaborators

  • byself.wang