New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

postcss-px2px

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-px2px

A plugin for PostCSS that convert px to rem AND rem to px AND px to rpx AND rpx to px

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-px2px

A plugin for PostCSS that convert px to rem AND rem to px AND px to rpx AND rpx to px

Refer to

pxtorem AND pxtorpx-pro AND

Options

const options = {
  input: "px",
  output: "rpx",
  unitPrecision: 5,
  selectorBlackList: [],
  propBlackList: [],
  minPixelValue: 0,
  exclude: null,
  replace: true,
  transform: x => 2 * x
}

Import

// vite.config.js
import px2px from 'postcss-px2px'

export default defineConfig({
  css:{
    postcss: {
      plugins: [px2px({
        input: "rpx",
        output: "px",
        transform: x => x / 2
      })]
    }
  }
})

Input/Output

With the default settings, only font related properties are targeted.

// input
h1 {
    margin: 0 0 20px;
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: 1px;
}

// output
h1 { 
  margin: 0 0 40rpx; 
  font-size: 64rpx; 
  line-height: 1.2; 
  letter-spacing: 2rpx; 
}

FAQs

Package last updated on 24 Aug 2023

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