Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ggkovacs/node-px2rem
Pixel to rem postprocessor
https://github.com/ggkovacs/node-px2rem
nodejs postcss px2rem
Last synced: about 2 months ago
JSON representation
Pixel to rem postprocessor
- Host: GitHub
- URL: https://github.com/ggkovacs/node-px2rem
- Owner: ggkovacs
- License: mit
- Created: 2014-11-12T18:13:19.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T17:52:00.000Z (about 2 years ago)
- Last Synced: 2024-04-15T00:11:38.535Z (9 months ago)
- Topics: nodejs, postcss, px2rem
- Language: CSS
- Homepage:
- Size: 1.9 MB
- Stars: 27
- Watchers: 2
- Forks: 5
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pixel to rem [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverage-image]][coverage-url]
Version: **2.0.5**## Installation
Run `npm install node-px2rem`
## Usage
```js
'use strict';const fs = require('fs');
const px2rem = require('node-px2rem');
const css = fs.readFileSync('main.css', 'utf8');
const processedCSS = px2rem.process(css, {
rootValue: 16
});fs.writeFile('main-rem.css', processedCSS, (err) => {
if (err) {
throw err;
}console.log('Done.');
});
```## API
### Options
Type: `Object | Null`
Default:
```js
{
rootValue: 16,
unitPrecision: 5,
propertyBlackList: [],
propertyWhiteList: [],
replace: false,
mediaQuery: false,
minPx: 1
}
```- `rootValue` (Number) The root element font size.
- `unitPrecision` (Number) The decimal numbers to allow the REM units to grow to.
- `propertyBlackList` (Array) The properties that can't change from px to rem.
- `propertyWhiteList` (Array) The properties that can change from px to rem
- `replace` (Boolean) Replaces rules containing rems instead of adding fallbacks.
- `mediaQuery` (Boolean) Allow px to be converted in media queries.
- `minPx` (Number) If minimum px greater than or equal can change from px to rem.# License
MIT © 2021 Gergely Kovács ([email protected])[npm-image]: https://badge.fury.io/js/node-px2rem.svg
[npm-url]: https://npmjs.org/package/node-px2rem
[travis-image]: https://travis-ci.com/ggkovacs/node-px2rem.svg?branch=master
[travis-url]: https://travis-ci.com/ggkovacs/node-px2rem
[daviddm-image]: https://david-dm.org/ggkovacs/node-px2rem.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/ggkovacs/node-px2rem
[coverage-image]: https://coveralls.io/repos/ggkovacs/node-px2rem/badge.svg?service=github&branch=master
[coverage-url]: https://coveralls.io/github/ggkovacs/node-px2rem?branch=master