css-p2r-loader

0.0.2 • Public • Published

css-x2x-loader

Webpack loader for x2x css file

Getting Started

To begin, you'll need to install css-x2x-loader

$ npm install --save-dev css-x2x-loader

Then add the plugin to your webpack config.For example:

webpack.config.js

module.exports = {
	// ...
  module: {
    rules: [{
      test: /\.css$/,
      use: [{
        loader: 'style-loader'
      },
      {
        loader: 'css-loader'
      },
      {
        loader: 'css-x2x-loader',
        options: {
          type: 'px2rem',
          tagUnit: 75,
          tagPrecision: 8
        }
      }]
    }]
  }
}

options

name Type Default
type {String} px2rem
tagUnit {Number} 100
tagPrecision {Number} 6

type

Default: "px2rem"

Supported values:

  • px2rpx
  • rem2px
  • rem2rpx
  • rpx2px
  • rpx2rem

tagUnit

Default: 100

The 100 value means 100px = 1rem.

tagPrecision

Default: 6

The 6value means keep six decimal place.

Package Sidebar

Install

npm i css-p2r-loader

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

7.04 kB

Total Files

7

Last publish

Collaborators

  • smoore_fe