# postcss-rem2px

> postcss rem2px rem2rem

Latest version **1.1.4** (published 2022-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-rem2px
pnpm add postcss-rem2px
yarn add postcss-rem2px
bun add postcss-rem2px
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2022-01-11 |
| First published | 2022-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | duzhijie |
| Maintainers | duzhijie |
| Keywords | webpack, rem2px, rem2rem, loader |

## Links

- npm: https://www.npmjs.com/package/postcss-rem2px
- Repository: https://github.com/duzhijie317/postcss-rem2px
- Homepage: https://github.com/duzhijie317/postcss-rem2px#readme
- Issues: https://github.com/duzhijie317/postcss-rem2px/issues
- npm.io page: https://npm.io/package/postcss-rem2px

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.1.4 (latest) — 2022-01-11
- 1.1.3 — 2022-01-11
- 1.1.2 — 2022-01-11
- 1.1.1 — 2022-01-11
- 1.1.0 — 2022-01-11
- 1.0.3 — 2022-01-10
- 1.0.2 — 2022-01-10
- 1.0.0 — 2022-01-10

## README

# postcss-rem2px
postcss rem2px rem2rem

## Options
```
  transformType: 'rem',  // rem transform dest type : 'px' | 'rem' (default: 'rem')
  rate: 1,               // transform rem rate, eg: srcRootFontSize/destRootSize
  rootFontSize: 100,     // root fontsize value (default: 100)
  forbidComment: 'no',   // no transform value comment (default: `no`)
  precision: 4,          // transformed px or rem precision
  remLimit: 0            // no transform rem limit（default: 0）

```

## Computed
```
rem2px: regexpRemValue * rootFontSize 

rem2rem: regexpRemValue * rate
```

## Usage

### Node

```
var postcss = require('postcss');
var rem2px = require('postcss-rem2px');
var originCssText = '...';
var newCssText = postcss().use(rem2px({...options})).process(originCssText).css;
```

### Gulp

```
npm install gulp-postcss
```

```
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var rem2px = require('postcss-rem2px');

gulp.task('default', function() {
  var processors = [rem2px({...options})];
  return gulp.src('./src/*.css')
    .pipe(postcss(processors))
    .pipe(gulp.dest('./dest'));
});
```

### Webpack

```
npm install postcss-loader
```

```
postcss.config.js
```

```
module.exports = {
    plugins: [
        require('postcss-rem2px')({
            ...options
        }),
    ],
};
```

### Grunt

```
npm install grunt-postcss
```

```
module.exports = function(grunt) {
  grunt.initConfig({
    postcss: {
      options: {
        processors: [
          rem2px({...options})
        ]
      },
      dist: {
        src: 'src/*.css',
        dest: 'build'
      }
    }
  });
  grunt.loadNpmTasks('grunt-postcss');
  grunt.registerTask('default', ['postcss']);
}
```

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