# postcss-px-multiple

> Postcss multiple px unit

Latest version **0.1.5** (published 2018-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-px-multiple
pnpm add postcss-px-multiple
yarn add postcss-px-multiple
bun add postcss-px-multiple
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2018-07-16 |
| First published | 2018-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | torrac12 |
| Maintainers | torrac12 |
| Keywords | px-multiple, postcss-plugin |

## Links

- npm: https://www.npmjs.com/package/postcss-px-multiple
- Repository: https://github.com/torrac12/postcss-px-multiple-plugin
- Homepage: https://github.com/torrac12/postcss-px-multiple-plugin.git
- Issues: https://github.com/torrac12/postcss-px-multiple-plugin/issues
- npm.io page: https://npm.io/package/postcss-px-multiple

## Dependencies (2)

- [css](https://npm.io/package/css.md) ^2.2.3
- [postcss](https://npm.io/package/postcss.md) ^6.0.23

## Recent versions

- 0.1.5 (latest) — 2018-07-16
- 0.1.3 — 2018-07-16
- 0.1.2 — 2018-07-16
- 0.1.1 — 2018-07-16
- 0.1.0 — 2018-07-15

## README

## postcss-px-multiple-plugin

一个 postcss 的插件，可以把 css 文件中含 `px` 的样式乘以倍数，注意大写的 PX 不会转换。

这个插件对设计稿定义 `pt` 单位，实际 `1pt = 2px` 情况下很有用。另外当 `viewport` 设置成固定值且不为 `device-width` 时，比如 `width=750`，当引入第三方组件中的 css 时候，第三方组件一般都是按 `device-width` 写的尺寸，此时用此插件很好解决问题。

参考自：[postcss-px2rem](https://github.com/songsiqi/px2rem-postcss)

### Usage

wepback 的参考配置如下，gulp 和 grunt 可以自行查询

```
var pxMultiple = require('postcss-px-multiple');

module.exports = {
  module: {
    rules: {
      test: '/*.css/',
      use: [{
        loader: 'style-loader'
      }, {
        loader: 'css-loader'
      }, {
        loader: 'postcss-loader',
        options: {
          ident: 'postcss',
          plugins: [
            require('pxMultiple')({times: 2})
          ]
        }
      }]
    }
  }
}

```

效果如下：
```
/* origin file */
body {
  width: 100%;
  height: 20px;
  margin: 10px;
  font-size: 14px;
  border: 1PX solid black;
}


/* output file */
body {
  width: 100%;
  height: 40px;
  margin: 20px;
  font-size: 28px;
  border: 1PX solid black;
}

```

---
_Source: https://npm.io/package/postcss-px-multiple · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
