Skip to content

jack-pearson/postcss-px-to-rem

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

postcss-px-to-rem

A plugin for PostCSS that generates rem from pixel units.

This project was completed through the modification of njleonzhang.

Usage

If your project involves a fixed width, this script will help to convert pixels into rem.

Options

Default:

{
  unitToConvert: 'px',
  widthOfDesignLayout: 1920,
  unitPrecision: 5,
  selectorIncludeList: [],
  minPixelValue: 1,
  mediaQuery: false
};
  • unitToConvert (String) unit to convert, by default, it is px.
  • widthOfDesignLayout (Number) The width of the design layout. for pc dashboard, generally is 1920.
  • unitPrecision (Number) The decimal numbers to allow the REM units to grow to.
  • selectorIncludeList (Array) The selectors to ignore and leave as px.
    • If value is string, it checks to see if selector contains the string.
      • ['body'] will match .body-class
    • If value is regexp, it checks to see if the selector matches the regexp.
      • [/^body$/] will match body but not .body
  • minPixelValue (Number) Set the minimum pixel value to replace.
  • mediaQuery (Boolean) Allow px to be converted in media queries.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%