New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-px2rem

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-px2rem

Pixel to rem postproccessor

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
271
increased by5.45%
Maintainers
1
Weekly downloads
 
Created
Source

Pixel to rem NPM version Build Status Dependency Status Coverage Status

Version: 2.0.5

Installation

Run npm install node-px2rem

Usage

'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:

{
  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 (gg.kovacs@gmail.com)

Keywords

FAQs

Package last updated on 02 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc