Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

unit-convert-loader

1.0.2 • Public • Published

unit-convert-loader

Webpack loader for converting CSS unit

Install

npm install unit-convert-loader

Usage

Within your webpack configuration object, you'll need to add the unit-covert-loader to the list of modules, like so:

module: {
  rules: [
    {
      test: /\.vue$/,
      exclude: /node_modules/,
      use: {
        loader: 'unit-covert-loader',
        options: {
          UIWidth: 640,
          targetUnit: 'rem'
        }
      }
    }
  ]
}

Options

  • UIWidth: optional, default 750. The Design Width.
  • targetUnit: optional, default vw. The unit you want to convert to, it can be vw or rem.
  • minPixelValue: optional, default 1. The minimum value you set, all value less than it won't be converted.
  • unitPercesion: optional, default 3. Number of decimal places retained after conversion.
  • rem: optional, default null. The font size of html node, necessary when targetUnit is rem.

Install

npm i unit-convert-loader

DownloadsWeekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

308 kB

Total Files

12

Last publish

Collaborators

  • avatar